Hi there! I'm having some trouble with the Winsock control. I'm trying to connect to a POP3 server. Problem is, I have the winsock.Connect function, then the DataReceived event SHOULD be called (the POP3 welcome message upon connection), and then after the Connect function I have other things that read the welcome message (basically checking it's '+OK' and we can continue). So it looks similar to:

winsock.Connect
' Data received here hopefully, and written to recddata
If Left(recddata, 3) = "+OK" Then.... etc.

But, my problem is that it just skips completely past winsock.Connect, doesn't write anything to the data variable, and just goes on to the next line. However, if I put, say, an MsgBox function in the DataReceived event, and nothing after the Connect function, it connects, and displays the welcome message.

So, basically, whenever there's something after the Connect function, it seems to skip the function altogether. DoEvents doesn't make a difference, and a loop doesn't want to work either. Is there a way to just wait until it's Connected and the welcome message has been received?

Thank you so much in advance!!

best solution I can give is to try socketwrench from catalsyt.

this was mentioned to me by comatose as I was having problems with a project I was doing, and found that it helped me do what i want it to do.

http://www.catalyst.com

the addin is also free and you can download a help document on it as well

I read about that in a few places. I'll give it a shot, thanks :)

Are you tring the Winsock1_DataArrival method?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.