tfTftpdUserStart

Jump to: navigation, search

Table of Contents >> Application Reference >> TFTPD API


#include <trsocket.h>


int tfTftpdUserStart (
int maxConnections,
int sendTimeout,
int timeoutTime,
int blockingState
);


Function Description

This function opens a TFTP server socket and starts listening for incoming connections. tfTftpdUserStart() can be either blocking or non-blocking, as specified by the 'blockingState' parameter.


Blocking Mode

In blocking mode, tfTftpdUserStart() should be called from a task. tfTftpdUserStart() will not return unless an error occurs. It will block and wait for incoming connections, and execute the TFTP 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, tfTftpdUserStart() will return immediately after listening for incoming connections. It is the user's responsibility to then call tfTftpdUserExecute() periodically to execute the TFTP server code. Choose non-blocking mode if you do not have an RTOS/Kernel.


Parameters

  • maxConnections
    Maximum number of concurrent incoming TFTP connections allowed. Must be at least one.
  • sendTimeout
    The amount of time, in seconds, a connection can be idle before it times out.
  • timeoutTime
    The number of consecutive retries a connection will make before it gives up. Each time a connection times out, it counts as one retry.
  • 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:
  • 'maxConnections' is less than one.
  • 'blockingState' is neither TM_BLOCKING_ON nor TM_BLOCKING_OFF.
  • 'blockingState' is TM_BLOCKING_ON and blocking-mode is not enabled for the stack.
  • TM_SOCKET_ERROR
    Unable to create s socket.
  • (Other)
    This function uses various socket calls. Any other error codes returned will be from said socket calls.


Table of Contents >> Application Reference >> TFTPD API