TCP NOTIFY statement

Purpose

Designate which TCP/IP events will generate a notification message.

Syntax

TCP NOTIFY [#] fNum&, {SEND | RECV | ACCEPT | CONNECT | CLOSE} TO hWnd& AS wMsg&

Remarks

Designates which events (SEND, RECV, ACCEPT, CONNECT and CLOSE) will generate a wMsg& notification message to the window procedure (callback) of the GUI window or dialog whose window handle is contained in hWnd&.

Your program defines the wMsg& value, and this value should be equal or larger than %WM_USER + 500 to avoid conflict with other (common) callback message values.

When the nominated callback function receives the wMsg& notification, the wParam& parameter identifies the operating system's handle of the socket (see FILEATTR), the low-order Word of lParam& specifies the code of the event (see table below), and the high-order Word of lParam& contains the error code (if any).

LO(WORD, lParam&)

Definition

%FD_READ

Data is available to be read from the socket.

%FD_WRITE

The socket is ready for data to be written.

%FD_ACCEPT

The socket is able to accept a new connection.

%FD_CONNECT

The connection has been established.

%FD_CLOSE

The socket has been closed.

Notification messages do not arrive in unabated or continuous streams.  That is, once a particular notification message arrives, it will not be sent again until the initial message is acted upon.  For example, if a %FD_READ notification is received, it will not be resent until after a TCP RECV statement is executed.

The Winsock error codes are listed in WINSOCK2.INC, prefixed with %WSAE.

See also

TCP and UDP communications, TCP ACCEPT, TCP CLOSE, TCP LINE INPUT, TCP OPEN, TCP PRINT, TCP RECV, TCP SEND, UDP NOTIFY