TCP sockets in ionic

i believe the socket is set to paused mode on open
so you need to turn that off.

(window).chrome.sockets.tcp.setPaused(SocketId, false);

also, you should setup the receive handler BEFORE you send, as there would be a race condition if the
sender sent before the receive was ready… (it might cause the connection to break)

the server side just sends back ,right… doesn’t open a NEW connection back…

yes it just sends back. in this case it should send back the same data sent with send method.
do you have any idea how/where to start with the receive handler? sorry but i don’t have much programming exp, i am really new at it.

put some console.log stmts in to see what is going on.

make sure to move the addListener before the send
and also the setPauseD(socket, false)
before the send

yes i did put them before the send but doesn’t work. i did some debugg and i saw that the onReceive.addListener method does not get called.
directly after send method is called comes an error : errors.js:31 Connection reset by peer

The sender closed the connection before u could read the data