Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > winsock wait?


Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2003, 12:28 PM
gone's Avatar
gone gone is offline
Junior Contributor
 
Join Date: Mar 2003
Location: ohio
Posts: 226
Question winsock wait?


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?
Reply With Quote
  #2  
Old 03-03-2003, 01:02 PM
rust710 rust710 is offline
Contributor
 
Join Date: Oct 2002
Location: Michigan, USA
Posts: 516
Default

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.
Reply With Quote
  #3  
Old 03-03-2003, 01:15 PM
gone's Avatar
gone gone is offline
Junior Contributor
 
Join Date: Mar 2003
Location: ohio
Posts: 226
Default

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?
Reply With Quote
  #4  
Old 03-03-2003, 01:35 PM
rust710 rust710 is offline
Contributor
 
Join Date: Oct 2002
Location: Michigan, USA
Posts: 516
Default

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.
Code:
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.
Reply With Quote
  #5  
Old 03-03-2003, 11:01 PM
LiquidEnforcer LiquidEnforcer is offline
Newcomer
 
Join Date: Jan 2003
Posts: 18
Default

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
Reply With Quote
  #6  
Old 03-04-2003, 04:11 PM
gone's Avatar
gone gone is offline
Junior Contributor
 
Join Date: Mar 2003
Location: ohio
Posts: 226
Default

Quote:
Originally Posted by LiquidEnforcer
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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Winsock control at Run-time? wyrd Communications 4 03-28-2003 06:39 AM
how can I wait until winsock is connected and data is received margant Communications 2 08-12-2002 03:23 PM
Winsock Bcc and CC nutmeg Communications 8 07-11-2002 02:52 PM
WinSock in Class, Get from Other Class AnAx Communications 1 06-13-2002 05:29 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->