Hello, im using a SocketWrapper Named "SocketCom" it detects the connection drop fine but sometimes it doesnt... i have no idea why the socket thinks is online while is not.


this is the code which detects the connection drop
Code:
LPBYTE  lpData  = (LPBYTE)&stMsgProxy;

    while( IsOpen() ){ // if the port is Open
        // Blocking mode: Wait for event
        dwBytes = ReadComm(lpData, dwSize, dwTimeout);

        // Error? - need to signal error
        if (dwBytes == (DWORD)-1L){
            // Do not send event if we are closing
            if (IsOpen()){
                if ( bSmartAddressing ){
                    RemoveFromList( stMsgProxy.address );
                }
                OnEvent( EVT_CONDROP, &stMsgProxy.address ); // lost connection
            }
As i understand it attemps to read data from the Socket and if the read bytes result in
(DWORD)-1L launches the EVT_CONDROP.

I have another doub what does the L means there?

and why would this fail to detect the connection drop while the Run Thread still running.

and why reading that would give the signal to detect connection drop.

Thx in advance.