Re: Problem with Sended data
That's how it works. A TCP stream is a byte stream and has no more record or message structure than a typical stream textfile. Just as you have to add CrLf to break up a text file into "lines" you need to add something to break up the TCP stream into logical pieces... and you have to assemble the received stream and break out logical pieces at the receiver.
Unlike something like Line Input for files, the Winsock control doesn't provide any function for assembling data chunks and breaking out "lines."
People often fool themselves if they have a fast network and slow programs that send intermittently, because then it can seem like the data gets sent in some sort of datagram fashion. As soon as conditions change their programs fall over though.
Re: Problem with Sended data
I use "|" to separate data
but , why did two data are sent as if it is 1 data ? :eek:
ws1.SendData "Blues"
ws1.SendData "Red"
==
ws1.GetData x
==
then i find thet x contains "BluesRed" !!:afrog:
Re: Problem with Sended data
do you mean to do that :
ws1.SendData "Blues|"
ws1.SendData "Red|"
then use | as seperated if it's sent as "Blues|Red|" ?!
Re: Problem with Sended data
Quote:
Originally Posted by dBlues
do you mean to do that :
ws1.SendData "Blues|"
ws1.SendData "Red|"
then use | as seperated if it's sent as "Blues|Red|" ?!
Yes, then your program knows where one piece of data begins and the other ends.
The easiest way to parse that would be to use: Packets() = Split(Data, "|"). Then you have each "packet" in a separate array item.
Packets(0) = Blues
Packets(1) = Red
Re: Problem with Sended data
thanx dilettante & DigiRev
It was great :thumb:
Re: Problem with Sended data
If you consider this resolved, you could help us out by pulling down the Thread Tools menu and clicking the Mark Thread Resolved menu item. That will let everyone know that you have your answer.
Thank you. :)