Go to the source code of this file.
Accept a new connection.
If the socket is in blocking mode, this function will not return until a connection is actually received.
The connected argument points to a valid sfTcpSocket pointer in case of success (the function returns sfSocketDone), it points to a NULL pointer otherwise.
- Parameters
-
listener | TCP listener object |
connected | Socket that will hold the new connection |
- Returns
- Status code
Create a new TCP listener.
- Returns
- A new sfTcpListener object
Destroy a TCP listener.
- Parameters
-
listener | TCP listener to destroy |
Get the port to which a TCP listener is bound locally.
If the socket is not listening to a port, this function returns 0.
- Parameters
-
listener | TCP listener object |
- Returns
- Port to which the TCP listener is bound
Tell whether a TCP listener is in blocking or non-blocking mode.
- Parameters
-
listener | TCP listener object |
- Returns
- sfTrue if the socket is blocking, sfFalse otherwise
Start listening for connections.
This functions makes the socket listen to the specified port, waiting for new connections. If the socket was previously listening to another port, it will be stopped first and bound to the new port.
- Parameters
-
listener | TCP listener object |
port | Port to listen for new connections |
- Returns
- Status code
Set the blocking state of a TCP listener.
In blocking mode, calls will not return until they have completed their task. For example, a call to sfTcpListener_accept in blocking mode won't return until a new connection was actually received. In non-blocking mode, calls will always return immediately, using the return code to signal whether there was data available or not. By default, all sockets are blocking.
- Parameters
-
listener | TCP listener object |
blocking | sfTrue to set the socket as blocking, sfFalse for non-blocking |