tfRegisterSocketPacketCB
Table of Contents >> SSL Programmer's Reference
| #include <trsocket.h> |
| int tfRegisterSocketPacketCB | ( |
| int socketDescriptor, | |
| ttUserSocketCBPacketFuncPtr socketCBPacketFuncPtr, | |
| int flags | |
| ); |
Function Description
This function is used to register a user function on a particular TCP streaming socket that will be called once for every valid incoming packet that is destined for that socket. Specify a NULL value for socketCBPacketFuncPtr to remove a function pointer that was installed previously.By default, this feature is disabled to reduce code size. To use this function, uncomment the following macro definition in your <trsystem.h>.
#define TM_USE_TCP_INCOMING_CB
Parameters
- socketDescriptor
- The socket descriptor to register the call back for.
- socketCBPacketFuncPtr
- A pointer to the user-defined ttUserSocketCBPacketFunc function to be called for each packet received by the socket. Specify a NULL value to remove your callback function.
- flags
- Currently unused. Specify 0.
Returns
- TM_ENOERROR
- Success
- TM_SOCKET_ERROR
- Failure
| TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.
To retrieve the socket error the user must call tfGetSocketError(socketDescriptor). |
Possible socket errors
- TM_EBADF
- socketDescriptor is not a valid descriptor.