www.beck-ipc.com

@CHIP-RTOS C Library V2.00 - TCP/IP API


RegisterCallbackFunction

Register a user callback function.

int RegisterCallbackFunction ( int sd, void far *funcptr,
                               int eventflagmask,
                               int *error );

Parameters

sd

Socket descriptor.

funcptr

Pointer to user's callback function.

eventflagmask

Event flag mask bit field (see menu below)

error

Output parameter:  Failure code, 0 on success.

Return Value

0 = success
Non-zero = Failure (see error output parameter)

Comments

The events which trigger the callback are controlled with the eventflagmask input parameter.  The set of possible event flags are (defined in TCPIPAPI.H):

    CB_CONNECT_COMPLT - connection complete
    CB_ACCEPT   - remote has established a connection to our listening server
    CB_RECV   - incoming data arrived
    CB_SEND_COMPLT   - sending of data has been acknowledged by the peer
    CB_REMOTE_CLOSE   - peer has shut down the connection
    CB_SOCKET_ERROR   - an error occured on the connection
    CB_RESET   - peer has sent a rest on the connection
    CB_CLOSE_COMPLT   - close has been completed

These flags can be OR'ed together to form the mask for the set of events which you want to be called at.

The callback function should satisfy the following prototype (Borland C):

void huge socketCallBackFunc(int socketdescriptor, int eventFlags)

The callback function's parameter eventFlags contains the event(s) that have occured.  This bit field is encoded the same as the eventflagmask input parameter to this API function.

Before closing a socket, you must remove the callback function.   This is done by calling this API function with a null funcptr . and zero eventflagmask

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.


This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document