troubleshooting Question

Winsock's Data Arrival Event Occuring Before Connect Event

Avatar of barkin
barkin asked on
Programming Languages-OtherVisual Basic Classic
6 Comments1 Solution435 ViewsLast Modified:
Hi there,

I have been using the Winsock control for some time in my vb applications and have had no problems however just recently i have found that one of my winsock controls' events gets fired BEFORE it is supposed to.  More specifically, when i use the .Connect() function for this control it goes into a .State = 6 (Connecting) when this happens the control fires the event Data_Arrival() with 23 bytes (i believe) of data that has arrived DESPITE still being in "Connecting" state.  Shouldn't the control be in a "Connected" (state=7) state BEFORE windows auto triggers its Data_Arrival() event?  Anyway, when this "strange" data does arrive within this event procedure i use the .GetData() function and windows pops up an error indicating that the control is NOT in the correct state to receive this data yet (it is still in State = 6 mode -- Connecting).  

HOW THE HECK IS THIS POSSIBLE?  CAN SOMEONE TELL ME HOW IT IS DOING THIS AND HOW I CAN RESOLVE IT?

Btw, i have this control on a form and i make multiple instances of this form (i have done this with many other apps in the past with no problems but i just wanted to let you know).

READ THIS:

Hey, could it be that because i make a Connection to a remote site at a specific IP address (the port may change -- or it might be the same some times i guess) and then i shut down the connection via just hitting VB's STOP APP button or telling the remote side to cut the connection does some data linger in "limbo" so that when i restart the app and the connection is "reestablishing" (not quite yet fully connected) the remaining "Limbo" data is arriving now to me?


Thanks
ASKER CERTIFIED SOLUTION
Mindphaser

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros