Jump to content

TCP/IP string communication


Recommended Posts


I am writing a communication program. I receive a string of data and need to compare it with a couple of parameters. Anyone?

example :

i receive : /X354,Y653,Z345/

my PLC needs to recognize :  /X... , Y..... , Z.... /

in the future i also need to parse this and display the values in different text boxes.

thx in advance

Link to comment
Share on other sites

  • 1 month later...

first configure the PLC to be a TCP-Server


After that insert to the ladder the element to receive data from the client. The "Received Buffer" should be very long so your incoming message can be fully received with no problem. The "Length received" integer and "Received message" bit will be use to parse your message and get your information.


After receiving your buffer you would like to parse the massage, for that you first need to create the general form of the message your PLC receives. You said you will send a message that looks like "/X300,Y300,Z300/" while the numbers are the only one who change, so this is the general message form and in the places your numbers appears I put a different variable for each number. 



After that you should put the ladder element for parsing your message, and add your number to the HMI.


You can use a program called Hercules, to simulate TCP connection as a client, this is how I checked that my application works.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...