|
-
Jul 29th, 2007, 07:09 PM
#1
Thread Starter
Lively Member
Problem with Sended data
when i try to send alot of data after each athers , like sending data from a loop , like that :
for i = 0 to 9
ws1.senddata "Test" & i
next i
the recieved data is not separated and looks like that in:
"Test0Test1Test2Test3"
"Test4"
"Test5"
"Test6Test7"
"Test8Test9"
, got it ?!
like if i did :
ws1.senddata "Test0Test1Test2Test3"
ws1.senddata "Test4"
..
..
..
Help please ,
thanx
-
Jul 29th, 2007, 08:28 PM
#2
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.
-
Jul 29th, 2007, 08:45 PM
#3
Thread Starter
Lively Member
-
Jul 29th, 2007, 08:48 PM
#4
Thread Starter
Lively Member
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|" ?!
-
Jul 29th, 2007, 09:01 PM
#5
Re: Problem with Sended data
 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
-
Jul 29th, 2007, 09:19 PM
#6
Thread Starter
Lively Member
Re: Problem with Sended data
thanx dilettante & DigiRev
It was great
-
Jul 30th, 2007, 07:32 AM
#7
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|