TCP/IP Extension

Thx for suggestion, will be easier to test.

What does your client web server look like that answers the socket? Do you just listen on the port or do you need to add the websocket handshake scripting? I'm confused on how the javascript handshake relates to what is sent from Kodular.

Hola, Estoy mirando la Extensión y probando.

Logro conectarme a un servidor mediante TCP una conexion de escucha, y se logra!, pero entonces, no le puedo enviar mensajes, ya que me llegan los mensajes en BLANCO, la conexion se efectua para enviar el mensaje y mi servidor de escucha la detecta, pero no llega ninguna información en la conexion realizada. Alguna idea de por qué?

Hi,
Thnaks for sharing your great work. TCP socket is working very well, only thing is that when i am sending data from arduino to Test socket it is receiving all the characters except first. But when i receive the same data in other TCP terminals, i am getting all the characters.
Thnaks

Hi everyone,
I am using TCP/IP extension by Jean-Rodolphe_Letert. TCP socket which is working fine, only thing is that when i am sending data from arduino to Test socket it is receiving all the characters except first. But when i receive the same data in other TCP terminals, i am getting all the characters. Can anybody help please.
Thnaks

Hello,
Will investigate on this but I don't have much time to work on it, so I cannot give you an ETA ...
Cheers

Just looked at the java program ... can you tell me what is the first character lost ? is it always the same ? do you use hexaStringMode ?

Hi,
I am not using hexa mode and always missing the characters.
When i run below Arduino sketch, first couple of characters are always missing in TCP socket but not in other TCP terminals (checked with TCP client and TCP Terminal from play store).

const int potmeter1 = 0; 
      void setup() {
      pinMode(potmeter1, INPUT);
      pinMode(potmeter2, INPUT);
      Serial.begin(115200);
      tcp.begin(115200);
    }
      void loop() {
      char c=tcp.read();
      int potValue1 = analogRead(potmeter1); 
      potValue1 = map(potValue1, 0, 1023, 0, 1023);  //First potmeter mapped between 0 and 1023    
      tcp.print(potValue1);   
      }

------------
I foun that i i add empty line or 1 or 2 char before the potvalue , then tcp client will receive all the char of pot value without empty spaces or extra added char. modified sketch below.

const int potmeter1 = 0; 
      void setup() {
      pinMode(potmeter1, INPUT);
      pinMode(potmeter2, INPUT);
      Serial.begin(115200);
      tcp.begin(115200);
    }
      void loop() {
      char c=tcp.read();
      int potValue1 = analogRead(potmeter1); 
      potValue1 = map(potValue1, 0, 1023, 0, 1023);  

       tcp.print("             ");     // or tcp.print("a");   
      tcp.print(potValue1);   
      }

Thanks

Hi Jean-Rodolphe,

First of all thanks for the code that you provided!

I have a similar problem as others already reported that the FIRST character is missing when sending from ESP => App. For me it is only the first character, not several - So if I send "Test" from the Arduino IDE Serial Monitor I only receive "est" in the aia demo app.
It seems to have a similar behavior if I enable the Hexa String Mode - if I just transmit a single character the received text in the App is always "0D0A" - and this is independent of what single character I transmit.

For the moment I could workaround by always sending a dummy character as first character (e.g. "XTest") - however would be great if this would be working as intended.

Let me know if you want to debug this with me in a shared session...

Tobi

Excelent. Thanks for sharing.

how to replace the 2000 ms timeout time with another duration?

Hi thanks for the code.

How can i disable the error messages?

Thanks

Hello ;
I want to send data for a specific address at the plc register. I can connect to the my plc's HMI screen, thanks to your extension with TCP/IP. But I want to send a data to register adress. Do you have a any recommendation.

Hi Jean,

Great Extention exactly what I was looking for. :grin: :grin: :grin:

I tried using the Hexa mode, but noticed that when I send 123 "303132" on the receiving side I'm getting "30 31 32 00". I am always getting a null character added at the end of the message; which I do not want and will mess up things on the receiving side which I have no control off.

If I send "52" I'm receiving "52 00"

Is the null character coming from the Extention or ???, and is it possible to get rid of it. It only occurs when using the Hexmode... Or can we toggle on/off if needed for other scenarios...

TIA

Hello,
Sorry for not answering for a long time.
I don't know why this is happening because on my phone and with the basic project, there is no problem, I choose Hexa String Mode and send 303132, I receive on the other side 303132.
Here is a version of the extension with app inventor sources updated, can you try it and tell me if it make it works better ?

com.gmail.at.moicjarod.aix (18.3 KB)

Hi Jean,

Thanks for the response. I downloaded the new aix and Imported it into my app, where I got a message that the Extention got updated.

I tried the same scenarios and I am still seeing the Null characters added. So let me describe my testing:


The two blocks send Hex-"E" "52" when button pushed down and then sends Hex-"e" "72" when up.

So I should see "5272"
And I'm getting "52007200"

The same scenario but with Hex off and the actual ASCII characters, I get "Ee"

I am using Realterm on a laptop to test the output of the Wifi/RS232 adapter.


So if you can not replicate on your side, I'm wondering if its a setting in Realterm or the Adapter...

1 Like

Ok, so you confirm that it Only happens when hexastringmode is enabled ?

Yes. At the end of every send data the Nul character gets added.

I checked the output in Realterm where Display was set to Hex this way I can easily see if I'm receiving the Nul character. The Nul character does Not get added in none Hexa mode and only gets added in Hexa mode with every send data.

Phone: Samsung S9+, Android 10

Hi Jean,

I need to apologize since I must have messed up with upgrading the Extention.
I was testing again but this time I used your test app. I first upgraded it to the latest Extention and then added a check box to toggle Hexa Mode. When the hex mode was enabled, I did not get the Nul character.

I went back to my app and clicked on the Extention where I notice that the number of blocks is not the same as the one I just upgrded to using your test app.

So I must have messed up the upgrade and did not use the latest version you provided. When I corrected my mistake, things worked as expected.

Thanks again for the great Extention, and quick response.