Client Socket Extension by Jean-Rodolphe Letertre

I'm using the extension ClientSocketAI2Ext by Jean-Rodolphe Letertre.
It works really great and fits all my needs, but there is a problem:
trying to connect to a host which is not online it gives an "ERROR Connect Error (Socket Creation... END APPLICATION" that i am not able to intercept in the Screen Error.
Is there any workaround or a way to contact the Author? Thanks

I sent a private Email to the author of the extension, which was published in the old forum here

Let’s see, if he will provide an answer…


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

ok thanks let’s hope, i will inform the forum in case of solutions from the author.

Hello !
Well, on my smartphone (Blackberry Priv) when I try to connect to a shutoff server, I have this message :

Connect errorfailed to connect to / (port 10000) after 5000ms: isConnected failed: EHOSTUNREACH (No route to host)

and it’s not fatal (the app can continue).

I can dismiss this error message by unchecking the “DebugMessages” property in the ClientSocketA2IExt (the app does not connect by don’t tell the user). Did you try this ? Will it work on your smartphone as on mine ? I already noticed that behaviors could be different from a smartphone to another (and that’s a pity … it’s hard to make a correction to a program when you don’t have the problem yourself and can’t replicate it …).
Jean-Rodolphe Letertre

1 Like

Dear Jean-Rodolphe thanks for your help.
The message I get is a little bit different from yours:

Connect error (Socket Creation, please check Ip or hostname ->)failed to conect to / (port 10000) from / (port 55070) after 5000ms END APPLICATION

But also unchecking “DebugMessages” the error is the same. And if the error comes from the OS i don’t understand why it doesn’t fire the Screen.ErrorOccurred.
I’d love to use your extension as it works better than any other i could test.
Also I was trying to find how to pay for it or to pay for a further development of it but i was not able to find your contact. Compliments for what you already did.

Dear Jean-Rodolphe, i have news.
Playing around on this problem i found that now my phones acts like yours, I mean I don’t have Errors anymore. :smiley:
I don’t know why, after a million things i did from this morning i also had to restart my phone (because of some issues with my aistarter losing the connection between pc and phone). Maybe this was the reason??? But good to let you know in case of other people facing the same problem.
I will inform if the situation changes.
Anyway let me know how i can support you or your future developments.

Hi, I'm using the extension and it works fine !
I'm using A Wemos D1 R1.
my concern is when the arduino send several lines of data, how can I seperate each line on the application. When I check the datareceived event, the data contain multiple data lines sent by using println on the Arduino.
Thanks for your help !

if you can handle the lines sent by arduino it's easy, just put a header and an end that you can recognize on the receiver side: for example [LINESTART] and [LINEEND]

Yes, I can do that, but I already have separators inside the lines.
It should be better if the dataReceived event is triggered every time a data line is received corresponding to a println on Arduino.

You should use a buffer for all incoming data to manage them better

Hey Jean
First off massive thanks for the extension. I was drawing a blank on TCP in App Inventor till I found it.

Couple of troubles I've had though (I appreciate this isn't enough to solve it but making a start by mentioning the problem).

First off. Same one as @crlx2 i.e. when connecting to an IP with no computer using it I get the "application ending" error:

Connect error (Socket Creation, please check Ip or hostname ->)failed to conect to / (port 10000) from / (port 55070) after 5000ms END APPLICATION

(although it is 1000ms in my case because that's what I asked for and a different IP/port of course).

No biggie that one, just a minor niggle.

Another slightly more niggly one (but still not the end of the world) is that if do the following 3 times, my application hangs.

  1. Connect (successfully)
  2. Disconnect

Interestingly, if I do the above say twice then, instead of repeating a third time, connect, but then have the server disconnect me (as opposed to me do it from the app), this actually "resets the count", meaning I can repeat steps 1 and 2 three more times without hanging (it still hangs on the "new" third attempt though.

Only other odd thing is that the hang doesn't occur when the disconnect call is made. The app seems to carry on and execute my UI adjustment code (disables buttons that should only be active during a connection), then hang. So possibly hanging on exiting the event handler for the disconnect button.

I'm afraid I'm a bit new to App inventor and don't know how to go about better debugging (if there is such a thing?).

Final thing, when running your test application, it hangs after the first disconnect.

Let me know if I can help in any way with the extension. Would love to contribute if possible.

PS (to others) it looks like a few people have this disconnect problem reading through the posts here

PPS I'm going to take a look at this and see if I can get any meaningful logs out that may help with diagnosis

Hi Jean, i'm using your extention and work fine, thanks.
i'm using it to connect to a controller (esp) as SoftAP trough and android cellphone.
I'have just a trouble if i stop to use my app button the phone of course oes to sleep mode andlost socket connection.
i try also to set a timer "refreshing" connection every 60 seconds, but phone lose the connection in sleep mode.
i'm newbie, can you help me to understand how to set again the status of connection and datas as pre disconnection.?
thanks again for your extension. piero.

Hello Jean

I am trying to use your ClientSocketA2IExt with my Android mobile to send data to an application running under Windows 10 environment. This application has a built-in socket listener which listens on port 6100. I send message to the application which is not get received unless I disconnect the socket. Any workaround. Basically I am sending Gyro data to the application.

Hi Jean,

Thaks for your extension. How i can unckeck the "Debugmessages" property in the clientsocketa2iext?
Can you post a image?

Thanks very much!

Bonjour Jean,

Je ne sais pas si vous êtes français. Merci pour la extension fort utile. Est-il possible de me dire comme "uncheck" la propiété de debugmesages dans l'estension? Est-il possible de poster une image des blocs?

Merci par avance

I am using ClientSocketA2IExt and it connects ok to IP and PORT and sends and receives data ok.

But when I disconnect it looks like the DataReceived event repeats forever with the same data last received before the disconnect attempt.

The IP and PORT is accessed with an active Android VPN connection.

Extension Version: 4
Date Built: 2020-04-16


Updated the extension from this post

By that the disconnection problem is solved

Extension Version: 4
Date Built: 2021-07-08