TCP NOTIFY

Started by Michael Charnock, December 09, 2011, 07:13:51 AM

Previous topic - Next topic

Michael Charnock

Hi

Writing a network app, and was hoping that a callback from a TCP NOTIFY statement would let me know if the connection was dropped. This seems to work by sending a notification message to the windows or dialog specified.

Can I access a window's message loop from FF?

Thanks - Mike

ps Fantastic application - keep up the great work!

Michael Charnock

#1
Answering my own question... Can anyone confirm if this is the correct thing to do?

in FF_PumpHook

IF ISWINDOW( HWND_FORM1 ) THEN     
  SELECT CASE Msg.Message
    CASE %TCP_CLOSE
      ' Deal with the close
    CASE %TCP_SEND
      ' Net data sent
    CASE %TCP_RECV
      ' Net data received               
  END SELECT         
END IF

David Kenny

Assuming you set it up with something like this:

Tcp Notify fMyPort, Accept To HWND_FORM1 As %TCP_ACCEPT

use the custom message for Form1:

Function FORM1_CUSTOM ( _
                      hWndForm      As Dword, _  ' handle of Form
                      wMsg          As Long,  _  ' type of message
                      wParam        As Dword, _  ' first message parameter
                      lParam        As Long   _  ' second message parameter
                      ) As Long
  Select Case wMsg
    Case %TCP_CLOSE
      ' Deal with the close
    Case %TCP_SEND
      ' Net data sent
    Case %TCP_RECV
      ' Net data received               
  End Select   
End Function

Michael Charnock

Ah - I was putting my code in FF_PumpHook. Wasn't aware of the custom message for the form.

Many thanks.