/react-native-tcp

node's net api in react-native

Primary LanguageJavaScriptMIT LicenseMIT

TCP in React Native

node's net API in React Native

This module is used by Peel

Install

npm install gajjartejas/react-native-tcp --save

npx pod-install
or
cd ios && pod install && cd ..

Usage

see/run index.ios.js/index.android.js for a complete example, but basically it's just like net

const net = require("react-native-tcp");

const server = net
  .createServer(function (socket) {
    socket.write("excellent!");
  })
  .listen(12345);

const client = net.createConnection(12345);

client.on("error", function (error) {
  console.log(error);
});

client.on("data", function (data) {
  console.log("message was received", data);
});

TODO

  1. Use Typescript

PR's welcome!

originally forked from react-native-udp