23 #ifndef __ccxx_Socket_hxx 24 #define __ccxx_Socket_hxx 31 #ifdef CCXX_OS_WINDOWS 32 typedef int socklen_t;
33 typedef char FAR* sockbufptr_t;
37 #include <netinet/in.h> 38 #include <sys/socket.h> 39 typedef void * sockbufptr_t;
43 #define MSG_NOSIGNAL 0 44 #endif // MSG_NOSIGNAL 48 #ifdef CCXX_OS_WINDOWS 50 #define INVALID_SOCKET_HANDLE INVALID_SOCKET 53 #define INVALID_SOCKET_HANDLE (-1) 98 virtual void connect(
const String& addr, uint16_t port);
114 virtual void shutdown();
131 void setReceiveBufSize(
size_t size);
139 size_t getReceiveBufSize()
const;
147 void setSendBufSize(
size_t size);
155 size_t getSendBufSize()
const;
185 void setReuseAddress(
bool enable);
193 bool getReuseAddress()
const;
202 void setKeepAlive(
bool enable);
219 void setTCPDelay(
bool enable);
236 {
return(_connected); }
289 #endif // __ccxx_Socket_hxx TCP protocol.
Definition: Network.h++:44
bool isConnected() const
Determine if the socket is connected.
Definition: Socket.h++:235
SocketHandle getSocketHandle() const
Get the underlying socket handle for this socket.
Definition: Socket.h++:255
A server (listening) socket for StreamSocket (TCP) connections.
Definition: ServerSocket.h++:40
A base class for network sockets.
Definition: Socket.h++:61
NetProtocol getType() const
Get the socket type.
Definition: Socket.h++:239
const SocketAddress & getRemoteAddress() const
Get the address of the remote (peer) end of the socket.
Definition: Socket.h++:247
IOWaitMode
Definition: Socket.h++:252
SocketAddress _laddr
The local address.
Definition: Socket.h++:273
int SocketHandle
Definition: Socket.h++:52
A socket endpoint network address.
Definition: SocketAddress.h++:46
SocketAddress _raddr
The remote address.
Definition: Socket.h++:271
SocketHandle _socket
A handle to the socket itself.
Definition: Socket.h++:269
bool isInitialized() const
Determine if the socket has been initialized.
Definition: Socket.h++:231
A socket I/O selector.
Definition: SocketSelector.h++:351
#define COMMONCPP_API
Definition: Common.h++:126
NetProtocol
Network protocol types.
Definition: Network.h++:40
int timespan_s_t
A timespan expressed in seconds.
Definition: Integers.h++:91
Definition: Socket.h++:252
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
#define INVALID_SOCKET_HANDLE
Definition: Socket.h++:53
#define CCXX_COPY_DECLS(CLASS)
Inlines declarations of a copy constructor and assignment operator for the class CLASS.
Definition: Common.h++:295
int timespan_ms_t
A timespan expressed in milliseconds.
Definition: Integers.h++:104
int _sotimeout
The timeout value.
Definition: Socket.h++:275
NetProtocol _type
The socket type.
Definition: Socket.h++:267
Definition: AllocationMap.c++:25
const SocketAddress & getLocalAddress() const
Get the address of the local end of the socket.
Definition: Socket.h++:243