Panda3D
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
Public Member Functions | List of all members
OSocketStream Class Reference

A base class for ostreams that write to a (possibly non-blocking) socket. It adds is_closed(), which can be called after any write operation fails to check whether the socket has been closed, or whether more data may be sent later. More...

Inheritance diagram for OSocketStream:
Ostream SSWriter Ios IosBase

Public Member Functions

 close ()
 
bool flush ()
 Sends the most recently queued data now. This only has meaning if set_collect_tcp() has been set to true. More...
 
bool isClosed ()
 
- Public Member Functions inherited from Ostream
 flush ()
 
 put (char c)
 
 seekp (Ios::Streamoff off, IosBase::Seekdir dir)
 
 seekp (Ios::Streampos pos)
 
Ios::Streampos tellp ()
 
- Public Member Functions inherited from Ios
bool bad ()
 
 clear ()
 
bool eof ()
 
bool fail ()
 
bool good ()
 
- Public Member Functions inherited from SSWriter
 close ()
 
bool considerFlush ()
 Sends the most recently queued data if enough time has elapsed. This only has meaning if set_collect_tcp() has been set to true. More...
 
bool flush ()
 Sends the most recently queued data now. This only has meaning if set_collect_tcp() has been set to true. More...
 
bool getCollectTcp ()
 Returns the current setting of "collect-tcp" mode. See set_collect_tcp(). More...
 
double getCollectTcpInterval ()
 Returns the interval in time, in seconds, for which to hold TCP packets before sending all of the recently received packets at once. This only has meaning if "collect-tcp" mode is enabled; see set_collect_tcp(). More...
 
int getTcpHeaderSize ()
 Returns the header size for datagrams. See set_tcp_header_size(). More...
 
bool isClosed ()
 
bool sendDatagram (const Datagram dg)
 Transmits the indicated datagram over the socket by prepending it with a little-endian 16-bit byte count. Does not return until the data is sent or the connection is closed, even if the socket stream is non-blocking. More...
 
 setCollectTcp (bool collect_tcp)
 Enables or disables "collect-tcp" mode. In this mode, individual TCP packets are not sent immediately, but rather they are collected together and accumulated to be sent periodically as one larger TCP packet. This cuts down on overhead from the TCP/IP protocol, especially if many small packets need to be sent on the same connection, but it introduces additional latency (since packets must be held before they can be sent). More...
 
 setCollectTcpInterval (double interval)
 Specifies the interval in time, in seconds, for which to hold TCP packets before sending all of the recently received packets at once. This only has meaning if "collect-tcp" mode is enabled; see set_collect_tcp(). More...
 
 setTcpHeaderSize (int tcp_header_size)
 Sets the header size for datagrams. At the present, legal values for this are 0, 2, or 4; this specifies the number of bytes to use encode the datagram length at the start of each TCP datagram. Sender and receiver must independently agree on this. More...
 

Additional Inherited Members

- Public Types inherited from IosBase
enum  Openmode
 
enum  Seekdir { beg = 0, cur = 1, end = 2 }
 

Detailed Description

A base class for ostreams that write to a (possibly non-blocking) socket. It adds is_closed(), which can be called after any write operation fails to check whether the socket has been closed, or whether more data may be sent later.

Member Function Documentation

close ( )
bool flush ( )

Sends the most recently queued data now. This only has meaning if set_collect_tcp() has been set to true.

bool isClosed ( )