Click to See Complete Forum and Search --> : Failed to close socket connection


ohadbp
September 3rd, 2001, 03:33 PM
hi,

i am using a Winsock control in my application.
i wrote some lines of code in the Close event of the control but when i activate the Close function it doesn't close the connection and dont get into the Close event.

is that a common problem? any idea how to solve it?

thank,
ohad.

cksiow
September 3rd, 2001, 07:18 PM
somehow even we close it but winsock has an option called LINGER which determine the behaviour of the shutdown.... In VC++, CSocket can't control it, only CAsyncSocket can... I think winsock control should be similar to CSocket... but winsock control expose a property - SocketHandle which can be used with API.

I used to use the following code to make sure it really close..


Do While winsock1.State <> sckClosed
HTTPWS.Close
DoEvents
Loop








HTH

cksiow
http://vblib.virtualave.net - share our codes