gajjartejas / react-native-tcp

node's net api in react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

node's net api in react-native

License:MIT License


Languages

Language:JavaScript 35.8%Language:Objective-C 31.8%Language:Java 31.0%Language:Ruby 1.3%