Panda3D
Public Member Functions | List of all members
SocketStream Class Reference

A base class for iostreams that read and write to a (possibly non-blocking) socket. More...

Inheritance diagram for SocketStream:
Iostream SSReader SSWriter Istream Ostream BasicIosChar BasicIosChar IosBase IosBase

Public Member Functions

 close ()
 
bool flush ()
 Sends the most recently queued data now. More...
 
int getTcpHeaderSize ()
 Returns the header size for datagrams. More...
 
bool isClosed ()
 
 setTcpHeaderSize (int tcp_header_size)
 Sets the header size for datagrams. More...
 
- Public Member Functions inherited from Iostream
 flush ()
 
- Public Member Functions inherited from Istream
int get ()
 
 seekg (Streamoff pos)
 
 seekg (Streamoff off, IosBase::Seekdir dir)
 
Streamoff tellg ()
 
- Public Member Functions inherited from BasicIosChar
bool bad ()
 
 clear ()
 
bool eof ()
 
bool fail ()
 
bool good ()
 
- Public Member Functions inherited from Ostream
 flush ()
 
 put (char c)
 
 seekp (Streamoff pos)
 
 seekp (Streamoff off, IosBase::Seekdir dir)
 
Streamoff tellp ()
 
- Public Member Functions inherited from SSReader
 close ()
 
int getTcpHeaderSize ()
 Returns the header size for datagrams. More...
 
bool isClosed ()
 
bool receiveDatagram (Datagram dg)
 Receives a datagram over the socket by expecting a little-endian 16-bit byte count as a prefix. More...
 
 setTcpHeaderSize (int tcp_header_size)
 Sets the header size for datagrams. More...
 
- Public Member Functions inherited from SSWriter
 close ()
 
bool considerFlush ()
 Sends the most recently queued data if enough time has elapsed. More...
 
bool flush ()
 Sends the most recently queued data now. More...
 
bool getCollectTcp ()
 Returns the current setting of "collect-tcp" mode. 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. More...
 
int getTcpHeaderSize ()
 Returns the header size for datagrams. 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. More...
 
 setCollectTcp (bool collect_tcp)
 Enables or disables "collect-tcp" mode. 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. More...
 
 setTcpHeaderSize (int tcp_header_size)
 Sets the header size for datagrams. More...
 

Additional Inherited Members

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

Detailed Description

A base class for iostreams that read and write to a (possibly non-blocking) socket.

Member Function Documentation

◆ close()

close ( )

◆ flush()

bool flush ( )

Sends the most recently queued data now.

This only has meaning if set_collect_tcp() has been set to true.

◆ getTcpHeaderSize()

int getTcpHeaderSize ( )

Returns the header size for datagrams.

See set_tcp_header_size().

◆ isClosed()

bool isClosed ( )

◆ setTcpHeaderSize()

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.