1
- # react-native-tcp-socket
1
+ # react-native-tcp-socket <!-- omit in toc -->
2
2
<p align =" center " >
3
3
<img src =" https://github.com/Rapsssito/react-native-tcp-socket/workflows/tests/badge.svg " />
4
4
<img src =" https://img.shields.io/npm/dw/react-native-tcp-socket " />
7
7
8
8
React Native TCP socket API for Android & iOS with ** client SSL/TLS support** . It allows you to create TCP clients and servers sockets, imitating some of Node's [ net] ( https://nodejs.org/api/net.html ) API functionalities (check the available [ API] ( #api ) for more information).
9
9
10
- ## Table of Contents
10
+ ## Table of Contents <!-- omit in toc -->
11
11
12
12
- [ Getting started] ( #getting-started )
13
- - [ Self-Signed SSL] ( #self-signed-ssl-only-available-for-react-native--060 )
14
- - [ Compatibility] ( #react-native-compatibility )
13
+ - [ Using React Native >= 0.60] ( #using-react-native--060 )
14
+ - [ Self-Signed SSL (only available for React Native > 0.60)] ( #self-signed-ssl-only-available-for-react-native--060 )
15
+ - [ Using React Native < 0.60] ( #using-react-native--060-1 )
16
+ - [ React Native Compatibility] ( #react-native-compatibility )
15
17
- [ Usage] ( #usage )
18
+ - [ Client] ( #client )
19
+ - [ Server] ( #server )
20
+ - [ SSL Client] ( #ssl-client )
16
21
- [ API] ( #api )
17
22
- [ TcpSocket] ( #tcpsocket )
23
+ - [ ` createConnection() ` ] ( #createconnection )
18
24
- [ TcpServer] ( #tcpserver )
25
+ - [ ` listen() ` ] ( #listen )
19
26
- [ Maintainers] ( #maintainers )
20
27
- [ Acknowledgments] ( #acknowledgments )
21
28
- [ License] ( #license )
@@ -195,6 +202,12 @@ Here are listed all methods implemented in `react-native-tcp-socket`, their func
195
202
* [ ` setNoDelay([noDelay]) ` ] ( https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay )
196
203
* [ ` setTimeout(timeout[, callback]) ` ] ( https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback )
197
204
* [ ` write(data[, encoding][, callback]) ` ] ( https://nodejs.org/api/net.html#net_socket_write_data_encoding_callback )
205
+ * ** Properties:**
206
+ * [ ` 'remoteAddress' ` ] ( https://nodejs.org/api/net.html#net_socket_remoteaddress )
207
+ * [ ` 'remoteFamily' ` ] ( https://nodejs.org/api/net.html#net_socket_remotefamily )
208
+ * [ ` 'remotePort' ` ] ( https://nodejs.org/api/net.html#net_socket_remoteport )
209
+ * [ ` 'localAddress' ` ] ( https://nodejs.org/api/net.html#net_socket_localaddress )
210
+ * [ ` 'localPort' ` ] ( https://nodejs.org/api/net.html#net_socket_localport )
198
211
* ** Events:**
199
212
* [ ` 'close' ` ] ( https://nodejs.org/api/net.html#net_event_close_1 )
200
213
* [ ` 'connect' ` ] ( https://nodejs.org/api/net.html#net_event_connect )
@@ -203,7 +216,7 @@ Here are listed all methods implemented in `react-native-tcp-socket`, their func
203
216
204
217
#### ` createConnection() `
205
218
` createConnection(options[, callback]) ` creates a TCP connection using the given [ ` options ` ] ( #createconnection-options ) .
206
- ##### ` createConnection: options `
219
+ ##### ` createConnection: options ` <!-- omit in toc -->
207
220
** Required** . Available options for creating a socket. It must be an ` object ` with the following properties:
208
221
209
222
| Property | Type | iOS | Android | Description |
@@ -226,11 +239,16 @@ Here are listed all methods implemented in `react-native-tcp-socket`, their func
226
239
* [ ` TcpSocket.createServer(connectionListener) ` ] ( https://nodejs.org/api/net.html#net_net_createserver_options_connectionlistener )
227
240
* ** [ ` listen(options[, callback]) ` ] ( #listen ) **
228
241
* [ ` close([callback]) ` ] ( https://nodejs.org/api/net.html#net_server_close_callback )
242
+ * ** Events:**
243
+ * [ ` 'close' ` ] ( https://nodejs.org/api/net.html#net_event_close )
244
+ * [ ` 'connection' ` ] ( https://nodejs.org/api/net.html#net_event_connection )
245
+ * [ ` 'error' ` ] ( https://nodejs.org/api/net.html#net_event_error )
246
+ * [ ` 'listening' ` ] ( https://nodejs.org/api/net.html#net_event_listening )
229
247
230
248
#### ` listen() `
231
249
` listen(options[, callback]) ` creates a TCP server socket using the given [ ` options ` ] ( #listen-options ) .
232
250
233
- ##### ` listen: options `
251
+ ##### ` listen: options ` <!-- omit in toc -->
234
252
** Required** . Available options for creating a server socket. It must be an ` object ` with the following properties:
235
253
236
254
| Property | Type | iOS | Android | Description |
0 commit comments