04-26-2011 10:33 AM
Hello
I have a problem about server and client connection using TCP/IP. So in the client i have 41 cases, 1 case for timeout others are for button cases that when they are pressed then the LED in the server will be turn on and if they are clicked again the LED will be turn off. But when I reach cases 10, 11, 12 until 41 (button cases) the LED will be turned on if clicked one time but when it double clicked then the LED won't turn off. So how do you resolve the problem? Is it about subset or bytes to read because the first subset is 1 but cases no 10 until 41 won't work but i change the subset into 2 then the cases works for turn on the LED but it won't work for turn off the LED.
I also upload the vi into this for the reference.
the username for client is user and the password is pass.
Thanks
Solved! Go to Solution.
04-26-2011 11:16 AM
Your server is not parsing the messages correctly. The client is packaging them up correctly by sending the data length and then the data itself. However the server is not looking at the data length parameter and is parsing the message using assuming the message data length is constant. Fix your server to actually parse the message and you should be in business.
04-26-2011 11:38 AM
i'm still new in LabView so i don't know how to change the length of data into not constant at the server. Can you show it by fixing the problems in the vi? hehehe
Thanks
04-28-2011 08:16 AM
Good Morning,
From the comment above it looks like you need to parse your message. Here is a link to an KnowledgeBase article that shows you how to do just that. Hope this helps!
Parse String Input
http://decibel.ni.com/content/docs/DOC-2110
I hope you have a great rest of the day!
-Cody C
04-28-2011 08:57 AM
Hi ican,
it would be better if you change the ID to a fixed length. You can use typecast to get always 4Byte (if the value is U32 or I32) for the ID. Concatenate it with your one byte for the status.
See the attached image.
Hope it helps
Mike
04-28-2011 10:18 AM
Hy MikeS81
I have tried what you are suggesting but it won't work and the client have problem while sending the data. Can you uploaded the vi based on what you did because it won't work?
I also upload the vi based on what you did.
Thanks
04-29-2011 01:19 AM - edited 04-29-2011 01:20 AM
Hi ican,
you did not change the client. See the attached picture. The mistake in the server part is, that the 4 was connected on both split functions to the length. See the Server picture for the needed difference.
Mike