Sock [constructor] | Constructors |
~Sock [destructor] [virtual] | Destructor, close the socket or do nothing if empty. |
operator= | Assignment operators |
Accept [virtual] | accept(2) wrapper. Equivalent to std::make_unique<Sock>(accept(m_socket, addr, addr_len)). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. The returned unique_ptr is empty if accept() failed in which case errno will be set. |
Bind [virtual] | bind(2) wrapper. Equivalent to bind(m_socket, addr, addr_len). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
Connect [virtual] | connect(2) wrapper. Equivalent to connect(m_socket, addr, addrlen). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
GetSockName [virtual] | getsockname(2) wrapper. Equivalent to getsockname(m_socket, name, name_len). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
GetSockOpt [virtual] | getsockopt(2) wrapper. Equivalent to getsockopt(m_socket, level, opt_name, opt_val, opt_len). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
IsConnected [virtual] | Check if still connected. |
IsSelectable [virtual] | Check if the underlying socket can be used for select(2) (or the Wait() method). |
Listen [virtual] | listen(2) wrapper. Equivalent to listen(m_socket, backlog). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
Recv [virtual] | recv(2) wrapper. Equivalent to recv(m_socket, buf, len, flags);. Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
RecvUntilTerminator [virtual] | Read from socket until a terminator character is encountered. Will never consume bytes past the terminator from the socket. |
Send [virtual] | send(2) wrapper. Equivalent to send(m_socket, data, len, flags);. Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
SendComplete | SendComplete overloads |
SetNonBlocking [virtual] | Set the non-blocking option on the socket. |
SetSockOpt [virtual] | setsockopt(2) wrapper. Equivalent to setsockopt(m_socket, level, opt_name, opt_val, opt_len). Code that uses this wrapper can be unit tested if this method is overridden by a mock Sock implementation. |
Wait [virtual] | Wait for readiness for input (recv) or output (send). |
WaitMany [virtual] | Same as Wait(), but wait on many sockets within the same timeout. |
operator== | Check if the internal socket is equal to s. Use only in tests. |