Skip to main content
gamedev.net
🔒 Locked

LINGER Don't work!

Started by TeraZen Jan 2, 2002 at 4:21 PM 1 replies 800+ views
Original Post
TeraZen
TeraZen
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
Last of the Returners
mediamaster40
mediamaster40
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.
TeraZen
TeraZen
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?
Last of the Returners

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.