@CHIP-RTOS C Library - TCP/IP API
Register a TCP user callback function.
int RegisterCallbackFunction ( int sd,
void far *funcptr,
int *error );
- Socket descriptor.
- Pointer to user's callback function.
- Event flag mask bit field (see menu below)
- Output parameter: Failure
code, 0 on success.
- 0 = success
Non-zero = Failure (see error
- The events which trigger the callback are controlled with the
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
at which you want to be called.
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
input parameter to this API function.
Note that most of the call back calls will be made in the context of the drivers
receive task (e.g. task ETH0). Therefore processing should be kept at a minimum in the
call back function. The user call back function should set a flag or increase a counter and
signal the user application task.
A socket callback may be removed by calling this API function with
both a null funcptr
and zero eventflagmask
Closing the socket also deactivates
Before exiting a program, any sockets which have callbacks installed must either
be closed or have the callback removed. Otherwise a callback could be present
which references a program no longer loaded into memory.
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
for more details.
Supported since or modified in @CHIP-RTOS version
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document