I am new react native and trying to connect to an URL "someurl.com" which is running on port 8051 via TCP.
I have tried it through web socket but its not working.
In iOS they have implemented it by using streams. Below is the code sample in iOS.
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(
NULL,
(CFStringRef)/*DemoServer_Client, DemoServer_Client_Port*/ /*DemoServer*/ClientServer,
Client_Production_Port,
&readStream,
&writeStream);
I have tried it by using react-native-tcp npm but it's giving undefined object near Socket.connect. Please see below screenshot.
sockets connect error
Please help me in connecting to this server and getting the response in react-native.
Thanks