is there a way, when sending multiple messages through one winsock, to make sure winsock waits before sending a message?
say you're writing a program where there are two buttons
command 1 code is
winsock1.senddata "cmd:displaytime"
command 2 code is
winsock1.senddata "cmd:random"
is there a way to make sure it sends diplaytime then makes sure that is sent before sending random? so it doesnt come out
cmd:diplaytimecmd:random
on the other side?
rust710
03-03-2003, 01:02 PM
Well you could send back a signal saying I got your info and that would solve your problem but really your best bet is dilemiters(sp?). What my horrible spelling is trying to say is a character, any character though an obscure one is better, add it to the end of all outgoing data and have your reciving program look for and seperate the lines that clashed together. This will keep your data seperate and happy.
i do that between the command and the data, but if you put it on the end it will drop the second message won't it?
rust710
03-03-2003, 01:35 PM
In a TCP connection all data has a 99% chance of arrival under most conditions, the question is when. Data has a tendency to run together and arrive in one big block that your reciving program proably won't know what to do with it so by putting this character between the data you can seperate it no matter how it arrives. For example.
winsock1.senddata "cmd:displaytime" & "ÿ"
winsock1.senddata "cmd:random" & "ÿ"
In the above sample ÿ is the letter that the reciving program will look for and use a a marker to seperate your data. You should also remove the ÿ from your data after you seperate it. So now your data might come in to your reciving program looking like cmd:diplaytimeÿcmd:randomÿ but you will be able to seperate the data. Also adding DoEvents after each senddata will give more time to send the data lowering the chance of data getting stuck together.
Hope this helps.
LiquidEnforcer
03-03-2003, 11:01 PM
WinsockVB has a nice little article that will show you how to send/get data with packet delimeters.... http://www.winsockvb.com/article.php?article_id=26
WinsockVB has a nice little article that will show you how to send/get data with packet delimeters.... http://www.winsockvb.com/article.php?article_id=26
thank you alots