problem when disconnecting

Posted by Yetro on Tue 11 Jun 2002 03:57 AM — 9 posts, 32,485 views.

#0
I was using win xp.. and smaug work fine.. especially when a player do a quit, he got disconnected.
Now i am on a win me... and when a player does a quit, he doesnt got disconnected (Zmud,Gmud).
The last message from that player is:
numbers... XXXX has quit (room XXXXXXX)

I think.. that i have look something related.. but not remember where..

greeting
Australia Forum Administrator #1
Could be a problem with the TCP/IP implementation on ME. We've been over this ground before, try searching the forum.
#2
I too have a problem with disconnecting. I run windows 98, and as usual, the connection would disconnect with the original source code. I've modified my code alot since I started working with it, and I've read through the forums about things like the TCP/IP. I've done everything I could find in the forums to fix the problem, but nothing has worked yet. Is it possible I have modified the part of the code with disconnects players, and if so, where can I find that portion of the code?
-Alexander
USA #3
I am having the same problem on a Win 98se Machine

smaug 14a cygwin src modified

Telnet, Zmud (all versions) after the disconnect message it just hangs there and I have to manually disconnect from the client which at times can be irritating when Im doing alot of testing :P anyone care to explain how the disconnecting works or maybe even has a fix for it? shutting down and rebooting the mud disconnect like normal though? am I not closing something fully? am I full of questions? no need to answer that! I cant figure it out for the life of me. and I didnt have the problem with the original source.
Amended on Fri 31 Jan 2003 05:50 AM by Nexela
USA #4
Easiest way to track this down is get an unaltered copy of the do_quit function and compare it line by line to the version you are running on your muds. Somewhere in there should be the source of why players that quit arent extracted properly.
Australia Forum Administrator #5
The fact that it works on XP and not ME suggests it is an operating system problem and not a SMAUG bug.

The important thing about closing a socket (TCP/IP connection) is that the close is not instantaneous. The end doing the close (in this case the server, in response to the QUIT command) sends a TCP packet with the FIN (finish) bit set. The client has to acknowledge that packet and reply with its own packet with the FIN bit set. The server then needs to acknowledge that the client has closed.

If one of those steps does not work properly then the server could think that the client has not yet closed its connection and keep the connection "alive" while it waits for it to close completely.

It wouldn't surprise me a great deal to find some versions of Windows not handling closing of sockets correctly.

I notice this code in the server, you could try implementing it by taking out the #if and #endif lines ...


#if defined(SO_DONTLINGER) && !defined(SYSV)
    {
        struct  linger  ld;

        ld.l_onoff  = 1;
        ld.l_linger = 1000;

        if ( setsockopt( fd, SOL_SOCKET, SO_DONTLINGER,
                        (void *) &ld, sizeof(ld) ) < 0 )
        {
            perror( "Init_socket: SO_DONTLINGER" );
            closesocket( fd );
            exit( 1 );
        }       
    }
#endif



However, that didn't compile for me. :)
Amended on Fri 31 Jan 2003 10:39 PM by Nick Gammon
USA #6
It compiled for me when I took those lines out however it didnt correct the problem :P

Time for me to break out my shovel and dig deeper
Australia Forum Administrator #7
I just meant the two lines starting with #, not the lot.
USA #8
Those were the only lines I took out :P

maybe if I Define So_dontlinger? just have to remember Im still fairly new to coding so how would that be done