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) !
Properties :
serverAddress (R/W)
serverPort (R/W)
timeoutms (R/W)
hexaStringMode (R/W)
connectionState (RO)
debugMessages (RW)
Methods :
Connect
Disconnect
SendData
Events :
DataReceived
RemoteConnectionClosed
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.
Hello,
This extension is to be able to communication via the wifi network with a server at a low level state (well not so low, but just above Transport Layer …). You will then be able to send and receive information to any server by reimplementing the application layer needed.
I developed this extension to be able to communicate with the Ethernet shield of an Arduino card. I set up an TCP/IP server on the Arduino and use my extension to build an application to be the client to connect to it.
Cheers !
Hello, I’m a new user of App Inventor and I´m having some troubles with this app. When I run it, an error apears telling me that it cannot find the component: ClientSocketAI2Ext1. Could you please help me?
Yes Indeed same issue here setting (ClientSocketAI2Ext1.DebugMessages to false ) has no effect , it hangs on disconnect . I would really appreciate if someone has found a fix for this issue. I am using Android version 9.1
Ok, don’t have the problem on my phone. Will try it on my wife’s one (more recent) to be able to see the problem more precisely. No ETA (estimated time of achievement) though … :-S
Ok, tried to send new version to JP Le Riche, but he did not reply to me. Here is the new version, somebody can try it ? com.gmail.at.moicjarod.aix (18.2 KB)
(and why can’t I edit the first post ??)
Hello,
It depends, if you need 2kB, it's easy to change, but if you need any size ... I have to make more research to know how to solve the problems involved ...
Hi!
My premilinary guess is about 6-7kByte i need, but maybe i will split ti to smaller packages. i dunno yet.
Or i send my data in definitions and let the server compose the full stream from it.
I am using the ClientSocketAI2Ext to connect to ESP8266 SoftAp in order to scan and connect to an SSID. When the ESP8266 actually connects to the selected SSID it momentarily turns OFF and back ON its Access Point and the app crashes.
It should just raise an event but not crash. Any ideas?
Thanks.