tfTeldUserStart

Jump to: navigation, search

Table of Contents >> Application Reference >> Telnet Daemon


#include <trsocket.h>


int tfTeldUserStart (
int telnetOptionsAllowed,
int maxConnections,
int maxBackLog,
int blockingState
);


Function Description

This function opens a TELNET server socket and start listening for incoming connections. tfTeldUserStart() can be either blocking or non-blocking, as specified by its 'blockingState' parameter.


Blocking Mode

In blocking mode, tfTeldUserStart() should be called from a task. tfTeldUserStart() will not return unless an error occurs. It will block and wait for incoming connections, and execute the TELNET server code in the context of the calling task. Choose blocking mode if you are using an RTOS/Kernel.


Non-Blocking Mode

In non-blocking mode, tfTeldUserStart() will return immediately after listening for incoming connections. It is the user's responsibility to then call tfTeldUserExecute() periodically to execute the TELNET server code. Choose non-blocking mode if you do not have an RTOS/Kernel.


Parameters

  • telnetOptionsAllowed
    Indicates which options we allow the client to negotiate. The user can OR together TM_TELD_BINARY_ON and TM_TELD_ECHO_ON to allow binary transfer, and echo by the server respectively.
  • maxConnections
    Maximum number of concurrent accepted incoming telnet connections allowed. If zero, then the telnet server will accept as many connections as there are available sockets.
  • maxBackLog
    Maximum number of concurrent pending (before being accepted) incoming telnet connections allowed.
  • blockingState
    One of the following:
  • TM_BLOCKING_ON for blocking mode.
  • TM_BLOCKING_OFF for non-blocking mode.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    One of the following:
  • 'telnetOptionsAllowed' contains an invalid flag.
  • 'maxConnections' is either negative or, if non-zero, it exceeds or equals the current number of available TELNET connections.
  • 'blockingState' is neither TM_BLOCKING_ON or TM_BLOCKING_OFF.
  • TM_EALREADY
    tfTeldUserStart() has already been called.
  • TM_EMFILE
    There are no more sockets available to open the TELNET server listening socket.
  • TM_ENOBUFS
    Insufficient user memory available to complete the operation.
  • TM_EADDRINUSE
    The TELNET server port is already in use.
  • TM_ENOMEM
    Could not obtain a counting semaphore to be used for blocking the TELNET server (blocking mode only).


Table of Contents >> Application Reference >> Telnet Daemon