22
33node's [ net] ( https://nodejs.org/api/net.html ) API in React Native
44
5- This module is used by [ Peel] ( http://www.peel.com/ )
6-
75## Install
86
97* Create a new react-native project. [ Check react-native getting started] ( http://facebook.github.io/react-native/docs/getting-started.html#content )
108
119* In your project dir:
1210
1311```
14- npm install react-native-tcp --save
15- ```
16-
17- __ Note for iOS:__ If your react-native version < 0.40 install with this tag instead:
18- ```
19- npm install react-native-tcp@3.1.0 --save
12+ npm install @staltz/react-native-tcp --save
2013```
2114
2215## Link in the native dependency
2316
2417```
25- react-native link react-native-tcp
18+ react-native link @staltz/ react-native-tcp
2619```
2720
2821## Additional dependencies
@@ -45,8 +38,8 @@ _only if you want to write require('net') or require('tls') in your javascript_
4538``` json
4639{
4740 "react-native" : {
48- "net" : " react-native-tcp" ,
49- "tls" : " react-native-tcp/tls"
41+ "net" : " @staltz/ react-native-tcp" ,
42+ "tls" : " @staltz/ react-native-tcp/tls"
5043 }
5144}
5245```
@@ -59,8 +52,8 @@ _see/run [index.ios.js/index.android.js](examples/rctsockets) for a complete exa
5952var net = require (' net' );
6053var net = require (' tls' );
6154// OR, if not shimming via package.json "react-native" field:
62- // var net = require('react-native-tcp')
63- // var tls = require('react-native-tcp/tls')
55+ // var net = require('@staltz/ react-native-tcp')
56+ // var tls = require('@staltz/ react-native-tcp/tls')
6457
6558var server = net .createServer (function (socket ) {
6659 socket .write (' excellent!' );
@@ -92,14 +85,3 @@ socket.on('data', (data) => {
9285 console.log('data:' + data.toString('ascii'))
9386})
9487```
95-
96- ### TODO
97-
98- host name verification on tls upgrade not implemented on android
99- add select tests from node's tests for net
100-
101- PR's welcome!
102-
103-
104-
105- _ originally forked from [ react-native-udp] ( https://github.com/tradle/react-native-udp ) _
0 commit comments