net socket request never arrives #5585
Replies: 1 comment
-
Posted at 2016-09-27 by Kolban In your Espruino code running on the ESP8266, we might try adding:
it may be that there is an underlying socket connection error. Although I don't have any experience with it, another possibility would be to enable the ESP8266 specific debugging with:
and we can see if additional diagnostics are produced. I'd also look to see if base connectivity between the ESP8266 and 192.168.0.113 have been achieved using:
Posted at 2016-09-27 by ClearMemory041063 Attached is some code to try for TCP comunications. Attachments: Posted at 2016-09-27 by Injecteer @Kolban thanks for the answer!
prints out:
Posted at 2016-09-27 by Injecteer @ClearMemory041063 thanks for the code! Connecting 2 esp's is not my use-case. I rather need to establish a connection to a plain java (Server)Socket. My ESP JS code is very similar to yours. The code snippet I posted is executed in Posted at 2016-09-27 by Injecteer Btw, I tried also to use The funny thing is, that
Posted at 2016-09-27 by Injecteer So, after peeking the websocket code, I figured out what I did wrong. The correct code would be:
The trick was to use the Posted at 2016-09-28 by @allObjects @injecteer, I'm not so sure what you try to do... The documented code shows that there are two event driven callbacks setup in the (client) connect-callback: on('data',cb1) and on('end',cb2), hence they are BOTH NOT EXECUTED right away. They are executed on respective event driven by the server, where as in your code, (client) socket.end is executed right away - not event driven - while the connect event is still on its way... In your code I read that the client is not waiting for data. It just connects, and when the connection is established - connection-callback executed (and socket passed into the callback) - the client sends data and closes the socket. The only issue with the documentation is that the comment in the server has a typo: A new client (h)as connected. ;-) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-09-27 by Injecteer
I have the following code snippet:
Upon running, the server does not receive any data.
I tried also socket.write( JSON.stringify( obj ) ) and putting write/end calls inside of the callback function - neither worked.
The test code in Groovy works just fine:
Beta Was this translation helpful? Give feedback.
All reactions