Archived

This topic is now archived and is closed to further replies.

LINGER Don't work!

This topic is 5824 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi... I''m coding some chat server with VB and winsock control. Since I can''t control LINGER option with winsock control, I use winsock API with setsockopt! I set "l_lonoff" to 1 and "l_linger" to 5... My setsockopt returns 0 (so it''s sucessfull), but linger don''t work! If I use: Winsock1.SendData "foo" Winsock1.Close I will close immediately, without sending "foo"... Help me guys! What''s the problem? Thanks - TeraZen, Last of the Returners

Share this post


Link to post
Share on other sites
I have only used winsock in C, but I think your socket must be STREAM for lingering to work, makes sense since UDP and IPX don''t use handshaking. There also might be another way to close the socket non-abortively by using another function besides Close, in C you use Close with a special SHUTDOWN flag to tell the socket to close gracefully.

Also in your example send "foo" will happen very quickly, try sending 10 or 100GB of data then doing a close, that way you can be sure data is still trying to be sent.

I think it is supposed to close immediately if the data is done as in your example.

Maybe your winsock control doesn''t support lingering (sounds like this might be problem to me), or you are using bad flags.

Share this post


Link to post
Share on other sites
Well... I can always make some DLL in C and call it with VB... But it should be the same! And I''m using Winsock 2 under Win2K, which surely support LINGER! Really... I don''t understand! Does someone ever successfully used LINGER?

Share this post


Link to post
Share on other sites