NCBI C++ ToolKit
|
Search Toolkit Book for CDatagramSocket
#include <connect/ncbi_socket.hpp>
Public Member Functions | |
CDatagramSocket (TSOCK_Flags flags=fSOCK_LogDefault) | |
CDatagramSocket:: More... | |
EIO_Status | Bind (unsigned short port) |
EIO_Status | Connect (const string &host, unsigned short port) |
EIO_Status | Connect (const string &hostport) |
EIO_Status | Connect (unsigned int host, unsigned short port) |
EIO_Status | Wait (const STimeout *timeout=kInfiniteTimeout) |
EIO_Status | Recv (void *buf, size_t buflen, size_t *msglen=0, string *sender_host=0, unsigned short *sender_port=0, size_t maxmsglen=0) |
EIO_Status | Send (const void *data, size_t datalen, const string &host=string(), unsigned short port=0) |
EIO_Status | Clear (EIO_Event direction) |
EIO_Status | SetBroadcast (bool do_broadcast=true) |
TNCBI_BigCount | GetMessageCount (EIO_Event direction) const |
Message count. More... | |
Public Member Functions inherited from CSocket | |
CSocket (void) | |
CSocket:: More... | |
CSocket (const string &host, unsigned short port, const STimeout *timeout=kInfiniteTimeout, TSOCK_Flags flags=fSOCK_LogDefault) | |
Create a client-side socket connected to "host:port". More... | |
CSocket (const string &hostport, const STimeout *timeout=kInfiniteTimeout, TSOCK_Flags flags=fSOCK_LogDefault) | |
Create a client-side socket connected to "host:port". More... | |
CSocket (unsigned int host, unsigned short port, const STimeout *timeout=kInfiniteTimeout, TSOCK_Flags flags=fSOCK_LogDefault) | |
Variant of the above, which takes host as a binary value in network byte order. More... | |
virtual | ~CSocket (void) |
Call Close(), then self-destruct. More... | |
EIO_Status | GetStatus (EIO_Event direction) const |
Return status of *last* I/O operation without making any actual I/O. More... | |
EIO_Status | Connect (const string &host, unsigned short port, const STimeout *timeout=kDefaultTimeout, TSOCK_Flags flags=fSOCK_LogDefault) |
Connect to "host:port". More... | |
EIO_Status | Connect (const string &hostport, const STimeout *timeout=kDefaultTimeout, TSOCK_Flags flags=fSOCK_LogDefault) |
Connect to "host:port". More... | |
EIO_Status | Reconnect (const STimeout *timeout=kDefaultTimeout) |
Reconnect to the same address. More... | |
EIO_Status | Shutdown (EIO_Event how) |
Shutdown socket I/O in the specified direction. More... | |
EIO_Status | Close (void) |
Close socket. More... | |
EIO_Status | Wait (EIO_Event event, const STimeout *timeout) |
Wait for I/O availability in the socket. More... | |
EIO_Status | SetTimeout (EIO_Event event, const STimeout *timeout) |
Set timeout for I/O in the specified direction. More... | |
const STimeout * | GetTimeout (EIO_Event event) const |
Get timeout for I/O in the specified direction. More... | |
EIO_Status | Read (void *buf, size_t size, size_t *n_read=0, EIO_ReadMethod how=eIO_ReadPlain) |
Read from socket. More... | |
EIO_Status | ReadLine (string &str) |
Read a line from socket (up to CR-LF, LF, or null character, discarding any of the EOLs). More... | |
EIO_Status | ReadLine (char *buf, size_t size, size_t *n_read=0) |
Read a line from socket (up to CR-LF, LF, or null character, discarding any of the EOLs). More... | |
EIO_Status | Pushback (const void *buf, size_t size) |
Push back data to socket (to be read out first). More... | |
EIO_Status | Write (const void *buf, size_t size, size_t *n_written=0, EIO_WriteMethod how=eIO_WritePersist) |
Write to socket. More... | |
EIO_Status | Abort (void) |
Abort socket connection. More... | |
unsigned short | GetLocalPort (ENH_ByteOrder byte_order, bool trueport=false) const |
Get socket local port number. More... | |
unsigned short | GetRemotePort (ENH_ByteOrder byte_order) const |
Get socket remote port number. More... | |
void | GetPeerAddress (unsigned int *host, unsigned short *port, ENH_ByteOrder byte_order) const |
Get peer address. More... | |
string | GetPeerAddress (ESOCK_AddressFormat format=eSAF_Full) const |
Get peer address as a text string. More... | |
virtual EIO_Status | GetOSHandle (void *handle_buf, size_t handle_size, EOwnership ownership=eNoOwnership) const |
Access to the system-specific socket handle. More... | |
ESwitch | SetReadOnWrite (ESwitch read_on_write=eOn) |
ESwitch | SetInterruptOnSignal (ESwitch interrupt=eOn) |
void | SetReuseAddress (ESwitch reuse=eOff) |
void | SetCork (bool on_off=true) |
void | DisableOSSendDelay (bool on_off=true) |
ESwitch | SetDataLogging (ESwitch log=eOn) |
bool | IsDatagram (void) const |
bool | IsClientSide (void) const |
bool | IsServerSide (void) const |
bool | IsUNIX (void) const |
bool | IsSecure (void) const |
TNCBI_BigCount | GetPosition (EIO_Event direction) const |
Positions and stats (direction is either eIO_Read or eIO_Write). More... | |
TNCBI_BigCount | GetCount (EIO_Event direction) const |
TNCBI_BigCount | GetTotalCount (EIO_Event direction) const |
void | Reset (SOCK sock, EOwnership if_to_own, ECopyTimeout whence) |
Close the current underlying "SOCK" (if any, and if owned), and from now on use "sock" as the underlying "SOCK" instead. More... | |
EOwnership | SetOwnership (EOwnership if_to_own) |
Specify if this "CSocket" is to own the underlying "SOCK". More... | |
SOCK | GetSOCK (void) const |
Access to the underlying "SOCK". More... | |
bool | IsEmpty (void) const |
virtual POLLABLE | GetPOLLABLE (void) const |
Public Member Functions inherited from CPollable | |
virtual | ~CPollable () |
Protected Member Functions | |
EIO_Status | Shutdown (EIO_Event how) |
EIO_Status | Reconnect (const STimeout *timeout) |
EIO_Status | Abort (void) |
Protected Member Functions inherited from CPollable | |
CPollable (void) | |
Additional Inherited Members | |
Protected Attributes inherited from CSocket | |
SOCK | m_Socket |
EOwnership | m_IsOwned |
Timeouts. More... | |
STimeout * | o_timeout |
eIO_Open More... | |
STimeout * | r_timeout |
eIO_Read More... | |
STimeout * | w_timeout |
eIO_Write More... | |
STimeout * | c_timeout |
eIO_Close More... | |
STimeout | oo_timeout |
storage for o_timeout More... | |
STimeout | rr_timeout |
storage for r_timeout More... | |
STimeout | ww_timeout |
storage for w_timeout More... | |
STimeout | cc_timeout |
storage for c_timeout More... | |
Datagram socket
Definition at line 528 of file ncbi_socket.hpp.