tfTeldUserCreate
Table of Contents >> Application Reference >> Telnet Daemon
#include <trsocket.h> |
ttUserTeldSrvHandle tfTeldUserCreate | ( |
int addressFamily, | |
int flags, | |
int TM_FAR * errorCodePtr | |
); |
Function Description
This function creates a Telnet server instance and returns a handle to that instance. The Telnet server handle may then be used for other Multiple Server API function calls. The Telnet server socket is created but will not begin listening for clients until the first call to tfTeldUserExecuteHandle(). This allows you to customize the server via the tfTeldUserSetSockopt() call.
Parameters
- addressFamily
- Specify AF_INET for an IPv4 server or AF_INET6 for an IPv6 server. Specify 0 for the default, based on your configuration (IPv6 if available, otherwise IPv4). If you have a dual-mode configuration, specify AF_INET6 to accept connections from both IPv4 and IPv6 clients.
- flags
- Configuration parameters. Specify a bitwise OR of the desired values listed in the Flags section below.
- errorCodePtr
- A pointer to an integer variable to receive the error result. (See Error Codes below.)
Flags
- TM_BLOCKING_ON
- Run in blocking mode.
- TM_BLOCKING_OFF
- Run in non-blocking mode. If TM_BLOCKING_ON is also specified, it takes precedence. If neither TM_BLOCKING_OFF nor TM_BLOCKING_ON are specified, non-blocking mode is the default.
- TM_TELD_BINARY_ON
- Allow the Telnet client to enable binary transfer.
- TM_TELD_ECHO_ON
- Allow the Telnet client to enable character echo.
Returns
- !NULL
- The handle to the new Telnet server instance.
- NULL
- Failed to create a Telnet server instance, refer to *errorCodePtr for the error code.
Error Codes
- TM_ENOERROR
- Success
- TM_EPERM
- Not initialized; call tfTeldUserInit() first.
- TM_EMFILE
- Too many servers (see tfTeldUserInit()).
- TM_EINVAL
- Invalid parameter.
- TM_ENOBUFS
- Insufficient memory.