You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
5
+
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).
6
6
7
7
## Table of Contents
8
8
@@ -11,8 +11,8 @@ React Native TCP socket API for Android & iOS with **client SSL/TLS support**. I
11
11
-[Compatibility](#react-native-compatibility)
12
12
-[Usage](#usage)
13
13
-[API](#api)
14
-
-[Client](#client)
15
-
-[Server](#server)
14
+
-[TcpSocket](#tcpsocket)
15
+
-[TcpServer](#tcpserver)
16
16
-[Maintainers](#maintainers)
17
17
-[Acknowledgments](#acknowledgments)
18
18
-[License](#license)
@@ -113,7 +113,7 @@ To use this library you need to ensure you are using the correct version of Reac
_Note: In order to use self-signed certificates make sure to [update your metro.config.js configuration](#self-signed-ssl-only-available-for-react-native--060)._
180
180
181
181
## API
182
-
### Client
182
+
Here are listed all methods implemented in `react-native-tcp-socket`, their functionalities are equivalent to those provided by Node's [net](https://nodejs.org/api/net.html) (more info on [#41](https://github.com/Rapsssito/react-native-tcp-socket/issues/41)). However, the **methods whose interface differs from Node are shown in bold**.
|**`port`**|`<number>`| ✅ | ✅ |**Required**. Port the socket should connect to. |
197
200
|`host`|`<string>`| ✅ | ✅ | Host the socket should connect to. IP address in IPv4 format or `'localhost'`. **Default**: `'localhost'`. |
201
+
|`timeout`|`<number>`| ✅ | ✅ | If set, will be used to call [`setTimeout(timeout)`](https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback) after the socket is created, but before it starts the connection. |
198
202
|`localAddress`|`<string>`| ✅ | ✅ | Local address the socket should connect from. If not specified, the OS will decide. It is **highly recommended** to specify a `localAddress` to prevent overload errors and improve performance. |
199
203
|`localPort`|`<number>`| ✅ | ✅ | Local port the socket should connect from. If not specified, the OS will decide. |
200
204
|`interface`|`<string>`| ❌ | ✅ | Interface the socket should connect from. If not specified, it will use the current active connection. The options are: `'wifi', 'ethernet', 'cellular'`. |
@@ -205,18 +209,11 @@ _Note: In order to use self-signed certificates make sure to [update your metro.
205
209
206
210
**Note**: The platforms marked as ❌ use the default value.
207
211
208
-
#### `write()`
209
-
*`data`: `<string> | <Buffer> | <Uint8Array>`
210
-
*`encoding`: `<string>`. Only used when `data` is `string`. Default: `utf8`.
211
-
*`callback `: `<Function>`
212
-
213
-
`write(data[, encoding][, callback])` sends data on the socket. The second parameter specifies the encoding in the case of a string — it defaults to UTF8 encoding.
0 commit comments