simple-socket library 1.5.0
Loading...
Searching...
No Matches
TCPSocket.h
1#ifndef NET_TCPSocket_h__
2#define NET_TCPSocket_h__
3
4#include "SocketHandle.h"
5#include "InternetSocket.h"
6
7namespace NET
8{
11 {
12 public:
15
20 TCPSocket( AddressFamily family = IPv4);
21
26 explicit TCPSocket( Handle&& handle);
27
30
32
41 void setNoDelay( bool enable);
42
44
59 Handle accept() const;
60
62
82 Handle timedAccept( int timeout) const;
83
86
89 };
90
91} // namespace NET
92
93#endif // NET_TCPSocket_h__
InternetSocket(int sockfd)
create socket from a SocketHandle returned by an accept() call
int receiveAll(void *buffer, size_t len)
receive exactly the requested amount unless the peer disconnects
void listen(int backlog=5)
listen for incoming connections
int sendAll(const void *buffer, size_t len)
send data through a connected socket
A simple class to provide strict ownership of socket handles.
TCPSocket(AddressFamily family=IPv4)
Definition TCPSocket.cpp:10
SocketHandle< TCPSocket > Handle
Handle for a new socket returned by accept().
Definition TCPSocket.h:14
void setNoDelay(bool enable)
Enable or disable TCP_NODELAY.
Definition TCPSocket.cpp:18
Handle timedAccept(int timeout) const
wait for another socket to connect
Definition TCPSocket.cpp:31
Handle accept() const
wait for another socket to connect
Definition TCPSocket.cpp:25