|
-
Jan 20th, 2008, 01:07 AM
#1
Thread Starter
New Member
VB6 making function wait for winsock data arrival
I am making a program in which I want to make a function send data on network using winsock. I want to make my function to wait until data is received at TCP port. And when data is received it should again start its execution.
Thanks
-
Jan 20th, 2008, 01:10 AM
#2
Re: VB6 making function wait for winsock data arrival
Moved from Visual Basic FAQs
-
Jan 20th, 2008, 05:13 AM
#3
Addicted Member
Re: VB6 making function wait for winsock data arrival
I using Pause:
Public Sub Pause(Second As Double)
On Error Resume Next
Dim Dim_Dbl_AtTime As Double
Dim_Dbl_AtTime = Timer
Do While Timer - Dim_Dbl_AtTime < Val(Second)
DoEvents
Loop
End Sub
-
Jan 20th, 2008, 09:57 AM
#4
Re: VB6 making function wait for winsock data arrival
You can't.
TCP is a reliable stream protocol. This means the underlying software tries very hard to make sure everything arrives and is presented in the proper sequence. This involves a lot of buffering and control operations you have no direct access to from where your program is.
The question is a little like asking how to know a record got written to disk. Using high-level stream I/O you don't get such notifications.
Unless the receiving program watches everything it receives and sends back some kind of notification your TCP program will never really know when complete data was received. Why should it? TCP wasn't designed to be used that way. It isn't message oriented, it is based on continuous streams and works very hard to abstract away the underlying exchange of packets, the windowing it does, the retry requests it makes, congestion control, stream reassembly, and lots of other things.
Maybe if you back up and describe what you want to accomplish at a higher level you'll get more useful responses.
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
|