Skip to content

PlayerLink::Server::TCPServer

Inherits from Socket

Public Functions

Name
TCPServer()
Constructs a TCPServer object.
void listen(std::string port, int backlog =5)
Listens to incoming bytes on a specified port.
TCPSocket accept()
Method to accept incomming connection request.
void monitorSocket(TCPSocket & fd)
Monitors the provided socket.
void unmonitor(TCPSocket & fd)
Stops monitoring the provided socket.
std::vector< TCPSocket > getSocketEvents(int timeout =10000)
Gets the socket Events.

Additional inherited members

Public Functions inherited from Socket

Name
Socket(int family, int type, int flag)
Constructs a Socket object.
Socket(int fd)
std::string getAddress() const
Returns the IP Address of the remote device.
uint32_t getPort() const
int getSocketDescriptor() const
bool close()
Closes the connection.
bool isClosed()
bool setBlocking(bool swtch)
Allows you to set the blocking mode for this file descriptor.
int getLastError()

Protected Attributes inherited from Socket

Name
int mSocketFD
File Descriptor for this socket instance.
bool socketIsClosed
Flag if socket is open or closed.
bool isBlocked
Boolean to determine if blocking is enabled on this socket instance.

Public Functions Documentation

function TCPServer

TCPServer()

Constructs a TCPServer object.

Return:

function listen

void listen(
    std::string port,
    int backlog =5
)

Listens to incoming bytes on a specified port.

Parameters:

  • port The port you wish to monitor
  • backlog

function accept

TCPSocket accept()

Method to accept incomming connection request.

Return: TCPSocket Object used to hold information and methods to send/recieve information from them

function monitorSocket

void monitorSocket(
    TCPSocket & fd
)

Monitors the provided socket.

Parameters:

  • fd The File Descriptor for the socket you want to monitor

function unmonitor

void unmonitor(
    TCPSocket & fd
)

Stops monitoring the provided socket.

Parameters:

  • fd The File Descriptor for the socket you no longer want to monitor

function getSocketEvents

std::vector< TCPSocket > getSocketEvents(
    int timeout =10000
)

Gets the socket Events.

Parameters:

  • timeout

Return: SocketEvents in a vector


Updated on 20 January 2021 at 17:04:32 UTC