tradle / react-native-udp

node's dgram for react-native
MIT License
339 stars 154 forks source link

Can you make a lib of tcp ? #7

Closed PatrickSCLin closed 9 years ago

PatrickSCLin commented 9 years ago

HI, is possible to make a the other lib of tcp ? like GCDAsyncSocket?

mvayngrib commented 9 years ago

definitely possible and shouldn't be too hard. I'll probably take a stab at it in the near future.

PatrickSCLin commented 9 years ago

thanks bro, I'm just new to React Native, it's awesome, but I can't use TCP socket from JS, I found a component, WebSocket which in React Native, but it looks like only allow to using for http and ws.

mvayngrib commented 9 years ago

depending on your use case, you might be able to use react-native-udp with utp, or rudp. But that's only if your code is running on both sides of the "tcp" connection, like if you're building a peer to peer app.

PatrickSCLin commented 9 years ago

Can I use utp in *.ios.js ?

mvayngrib commented 9 years ago

sure, .ios.js is just a naming convention, it's really just .js

you should probably experiment a bit with React Native itself first before playing with networking. It's a different environment from node.js, and takes a bit of acclimation to the tooling, limitations, patterns, etc.

PatrickSCLin commented 9 years ago

.io.js is running on iOS side right ?

I thought utp only work on Node.JS ?

PatrickSCLin commented 9 years ago

my goal is building an app which able to access data via telnet (port 23 or ssh) protocol

would like to using tcp socket in .ios.js for some reasons

mvayngrib commented 9 years ago

React Native uses JavaScriptCore, so the JS environment is pretty similar to being in a browser. Modules like this one attempt to make it more like a node.js environment. tcp is on the todo list :)

PatrickSCLin commented 9 years ago

I just tried to make a lib "RCTTCPSocket" , it's able to connect now, https://github.com/PatrickSCLin/RCTTCPSocket will try to implement return the received data as byte-array later, thanks for your help :)

mvayngrib commented 9 years ago

cool! I will be keeping an eye on it :)

On Fri, Aug 7, 2015 at 5:14 AM, PatrickSCLIn notifications@github.com wrote:

I just tried to make a lib "RCTTCPSocket" , it's able to connect now, https://github.com/PatrickSCLin/RCTTCPSocket will try to implement return the received data as byte-array later, thanks for your help :)

— Reply to this email directly or view it on GitHub https://github.com/tradle/react-native-udp/issues/7#issuecomment-128649435 .