NCBI C++ ToolKit
Public Member Functions | List of all members
CConn_SocketStream Class Reference

Search Toolkit Book for CConn_SocketStream

This stream exchanges data in a TCP channel, using the SOCK socket API. More...

#include <connect/ncbi_conn_stream.hpp>

+ Inheritance diagram for CConn_SocketStream:
+ Collaboration diagram for CConn_SocketStream:

Public Member Functions

 CConn_SocketStream (const string &host, unsigned short port, unsigned short max_try, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0)
 Create a direct connection with host:port. More...
 
 CConn_SocketStream (const string &host, unsigned short port=0, const void *data=0, size_t size=0, TSOCK_Flags flgs=fSOCK_LogDefault, unsigned short max_try=DEF_CONN_MAX_TRY, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0)
 Create a direct connection with "host:port" and send an initial "data" block of the specified "size" first; the remaining communication can proceed as usual. More...
 
 CConn_SocketStream (SOCK sock, EOwnership if_to_own, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0)
 This variant uses an existing socket "sock" to build a stream upon it. More...
 
 CConn_SocketStream (CSocket &socket, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0)
 This variant uses an existing CSocket to build a stream up on it. More...
 
 CConn_SocketStream (const SConnNetInfo &net_info, const void *data=0, size_t size=0, TSOCK_Flags flgs=fSOCK_LogDefault, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0)
 Create a tunneled socket stream connection. More...
 
- Public Member Functions inherited from CConn_IOStream
 CConn_IOStream (CONN conn, bool close=false, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0, CT_CHAR_TYPE *ptr=0, size_t size=0)
 Create a stream based on CONN, which is to be closed upon stream dtor but only if "close" parameter is passed as "true". More...
 
virtual ~CConn_IOStream ()
 
string GetType (void) const
 
string GetDescription (void) const
 
EIO_Status SetTimeout (EIO_Event direction, const STimeout *timeout) const
 Set connection timeout for "direction". More...
 
const STimeoutGetTimeout (EIO_Event direction) const
 
EIO_Status Status (EIO_Event direction=eIO_Close) const
 
EIO_Status Fetch (const STimeout *timeout=kDefaultTimeout)
 Flush the stream and fetch the response (w/o extracting any user data) More...
 
virtual EIO_Status Pushback (const CT_CHAR_TYPE *data, streamsize size)
 Push the specified data "data" of size "size" back into the underlying connection CONN (making it look like received yet unread data). More...
 
SOCK GetSOCK (void)
 Get underlying SOCK, if available (e.g. after Fetch()) More...
 
CSocketGetSocket (void)
 Get CSocket, if available (else empty). More...
 
virtual EIO_Status Close (void)
 Close CONNection, free all internal buffers and underlying structures, and render the stream unusable for further I/O. More...
 
EIO_Status SetCanceledCallback (const ICanceled *canceled)
 Cancellation support. More...
 
CONN GetCONN (void) const
 
EIO_Status Wait (EIO_Event event, const STimeout *timeout=&kZeroTimeout)
 Equivalent to CONN_Wait(GetCONN(), event, timeout) More...
 

Additional Inherited Members

- Public Types inherited from CConn_IOStream
enum  { fConn_Untie = fCONN_Untie , fConn_DelayOpen = 2 , fConn_ReadUnbuffered = 4 , fConn_WriteUnbuffered = 8 }
 The values below must be compatible with TCONN_Flags. More...
 
typedef unsigned int TConn_Flags
 bitwise OR of EConn_Flag More...
 
typedef pair< CONNECTOR, EIO_StatusTConnPair
 
- Public Attributes inherited from CConn_IOStream
enum CConn_IOStream:: { ... }  EConn_Flag
 The values below must be compatible with TCONN_Flags. More...
 
- Static Public Attributes inherited from CConn_IOStream
static const STimeout kZeroTimeout = { 0, 0 }
 Polling timeout with the 0.0 time in it. More...
 
- Protected Member Functions inherited from CConn_IOStream
 CConn_IOStream (const TConnector &connector, const STimeout *timeout=kDefaultTimeout, size_t buf_size=kConn_DefaultBufSize, TConn_Flags flags=0, CT_CHAR_TYPE *ptr=0, size_t size=0)
 Create a stream based on CONNECTOR – only for internal use in derived classes. More...
 
EIO_Status x_Pushback (const CT_CHAR_TYPE *data, streamsize size, bool push=false)
 
void x_Destroy (void)
 
- Protected Member Functions inherited from CConnIniter
 CConnIniter (void)
 
- Protected Attributes inherited from CConn_IOStream
CConn_Streambufm_CSb
 

Detailed Description

This stream exchanges data in a TCP channel, using the SOCK socket API.

The endpoint is specified as a "host:port" pair. The maximal number of connection attempts is given via "max_try". More details on that: <connect/ncbi_socket_connector.h>.

See also
SOCK_CreateConnector, SOCK_Create

Definition at line 471 of file ncbi_conn_stream.hpp.


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:13 2024 by modify_doxy.py rev. 669887