Added setBlocking to Socket::Server.
This commit is contained in:
parent
89c4e766ed
commit
54a19d60e6
2 changed files with 8 additions and 0 deletions
|
@ -855,6 +855,13 @@ Socket::Connection Socket::Server::accept(bool nonblock){
|
|||
return tmp;
|
||||
}
|
||||
|
||||
/// Set this socket to be blocking (true) or nonblocking (false).
|
||||
void Socket::Server::setBlocking(bool blocking){
|
||||
if (sock >= 0){
|
||||
setFDBlocking(sock, blocking);
|
||||
}
|
||||
}
|
||||
|
||||
/// Close connection. The internal socket is closed and then set to -1.
|
||||
/// If the connection is already closed, nothing happens.
|
||||
void Socket::Server::close(){
|
||||
|
|
|
@ -109,6 +109,7 @@ namespace Socket {
|
|||
Server(int port, std::string hostname = "0.0.0.0", bool nonblock = false); ///< Create a new TCP Server.
|
||||
Server(std::string adres, bool nonblock = false); ///< Create a new Unix Server.
|
||||
Connection accept(bool nonblock = false); ///< Accept any waiting connections.
|
||||
void setBlocking(bool blocking); ///< Set this socket to be blocking (true) or nonblocking (false).
|
||||
bool connected() const; ///< Returns the connected-state for this socket.
|
||||
void close(); ///< Close connection.
|
||||
int getSocket(); ///< Returns internal socket number.
|
||||
|
|
Loading…
Add table
Reference in a new issue