Last year, I needed a component in AI2 that did the work of a client socket. As there wasn’t any, I used Web component instead, but it didn’t do everything I need. A few days ago, I saw that there were the possibility to use extensions, but didn’t find a client socket one. I decided to make one so.
Here it is : ClientSocket extension V0.4.4.2 (Trailling 00 bug repair and timeout set release) !
- serverAddress (R/W)
- serverPort (R/W)
- timeoutms (R/W)
- hexaStringMode (R/W)
- connectionState (RO)
- debugMessages (RW)
Known bugs :
I think that only messages less than 1024 bytes work
If connection to server is lost (not server shutdown, but wifi connection problem by example), no events will indicate it (but crashes are now fixed thx Axeley)
on some android devices, disconnection of the serveur is not crashing anymore the app.
If you want to send non ascii data, modify hexaStringMode to true and send data as “303132” to send characters “012”. Received data will be also hexa characters.
Timeout to server connect is 2000 ms default but can be changed.
If you want, you can use it, test it and report me suggestions and bugs.