Skip to content
Roberto Fronteddu edited this page Jan 30, 2016 · 4 revisions

ServerMocket.h

  1. ServerMocket (3)
  2. listen (1)
  3. listen (2)
  4. accept (1)
  5. close (0)
  6. setIdentifier (1)
  7. getIdentifier (0)

API Interface Presentation

ServerMocket (3)


Return type: none

Parameters:

  • const char *pszConfigFile = NULL Path to config file.
  • CommInterface *pCI = NULL
  • bool bDeleteCIWhenDone = false

Description: The main class for a server application to use the Mockets communication library. Similar in functionality to a server socket - used by a server to accept connections from client applications.

listen (1)


Return type: int >0 Port number; <0 Error code.

Parameters:

  • uint16 ui16Port Listen port.

Description: Initialize the server Mocket to accept incoming connections. Specifying a 0 for the port causes a random port to be allocated. Returns the port number that was assigned, or a negative value in case of error.

listen (2)


Return type: int >0 Port number; <0 Error code.

Parameters:

  • uint16 ui16Port Port number.
  • const char *pszListenAddr Address to listen.

Description: Initialize the server Mocket to accept incoming connections. Specifying a 0 for the port causes a random port to be allocated. Returns the port number that was assigned, or a negative value in case of error.

accept (1)


Return type: Mocket * Pointer to the Mocket instance.

Parameters:

  • uint16 ui16PortForNewConnection = 0 New port for the connection.

Description: Accept an incoming connection request, if ui16PortForNewConnection is zero randomly chose a port.

close (0)


Return type: int 0 Success; <0 Error code

Parameters:

  • none

Description: Close the Mocket conection.

void setIdentifier (1)


See Mocket.h

getIdentifier (0)


See Mocket.h