# SocketStream

from pandac.PandaModules import SocketStream

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

## Inheritance:

SocketStream: iostream SSReader SSWriter
iostream: istream ostream
istream: ios
ios: ios_base
ios_base:
ostream: ios
SSReader:
SSWriter:

## Methods of SocketStream:

close
flush
isClosed

## Methods of iostream:

flush

## Methods of istream:

get
seekg
tellg

## Methods of ios:

bad
clear
eof
fail
good

## Methods of ostream:

flush
put
seekp
tellp

## Methods of SSReader:

close
isClosed
receiveDatagram

## Methods of SSWriter:

close
considerFlush
flush
getCollectTcp
getCollectTcpInterval
isClosed
sendDatagram
setCollectTcp
setCollectTcpInterval

## Constants in ios_base:

beg | (seekdir)
cur | (seekdir)
end | (seekdir)

close virtual void SocketStream::close(void) = 0; Undocumented function.

flush bool SocketStream::flush(void); Description: Sends the most recently queued data now. This only has meaning if set_collect_tcp() has been set to true.

isClosed virtual bool SocketStream::is_closed(void) = 0; Undocumented function.

flush void iostream::flush(void); Undocumented function.

get int istream::get(void); Undocumented function.

seekg void istream::seekg(unsigned long int pos); Undocumented function.

tellg unsigned long int istream::tellg(void); Undocumented function.

bad bool ios::bad(void) const; Undocumented function.

clear void ios::clear(void); Undocumented function.

eof bool ios::eof(void) const; Undocumented function.

fail bool ios::fail(void) const; Undocumented function.

good bool ios::good(void) const; Undocumented function.

flush void ostream::flush(void); Undocumented function.

put void ostream::put(char c); Undocumented function.

seekp void ostream::seekp(unsigned long int pos); Undocumented function.

tellp unsigned long int ostream::tellp(void); Undocumented function.

close virtual void SSReader::close(void) = 0; Undocumented function.

isClosed virtual bool SSReader::is_closed(void) = 0; Undocumented function.

receiveDatagram bool SSReader::receive_datagram(Datagram &dg); Description: Receives a datagram over the socket by expecting a little-endian 16-bit byte count as a prefix. If the socket stream is non-blocking, may return false if the data is not available; otherwise, returns false only if the socket closes.

close virtual void SSWriter::close(void) = 0; Undocumented function.

considerFlush bool SSWriter::consider_flush(void); Description: Sends the most recently queued data if enough time has elapsed. This only has meaning if set_collect_tcp() has been set to true.

flush bool SSWriter::flush(void); Description: Sends the most recently queued data now. This only has meaning if set_collect_tcp() has been set to true.

getCollectTcp bool SSWriter::get_collect_tcp(void) const; Description: Returns the current setting of "collect-tcp" mode. See set_collect_tcp().

getCollectTcpInterval double SSWriter::get_collect_tcp_interval(void) const; Description: 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().

isClosed virtual bool SSWriter::is_closed(void) = 0; Undocumented function.

sendDatagram bool SSWriter::send_datagram(Datagram const &dg); Description: 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.

setCollectTcp void SSWriter::set_collect_tcp(bool collect_tcp); Description: 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). See set_collect_tcp_interval() to specify the interval of time for which to hold packets before sending them. If you enable this mode, you may also need to periodically call consider_flush() to flush the queue if no packets have been sent recently.

setCollectTcpInterval void SSWriter::set_collect_tcp_interval(double interval); Description: 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().