Panda3D
Public Types | Public Member Functions

ISocketStream Class Reference

This is a base class for istreams implemented in Panda that read from a (possibly non-blocking) socket. More...

Inheritance diagram for ISocketStream:
istream SSReader ios ios_base

List of all members.

Public Types

enum  openmode
enum  ReadState { RSInitial = 0, RSReading = 1, RSComplete = 2, RSError = 3 }
enum  seekdir { beg = 0, cur = 1, end = 2 }

Public Member Functions

bool bad ()
 clear ()
 close ()
bool eof ()
bool fail ()
int get ()
ReadState getReadState ()
int getTcpHeaderSize ()
 Returns the header size for datagrams.
bool good ()
bool isClosed ()
bool receiveDatagram (Datagram dg)
 Receives a datagram over the socket by expecting a little-endian 16-bit byte count as a prefix.
 seekg (unsigned long int pos)
 seekg (long int off, seekdir dir)
 setTcpHeaderSize (int tcp_header_size)
 Sets the header size for datagrams.
unsigned long int tellg ()

Detailed Description

This is a base class for istreams implemented in Panda that read from a (possibly non-blocking) socket.

It adds is_closed(), which can be called after an eof condition to check whether the socket has been closed, or whether more data may be available later.


Member Enumeration Documentation

enum openmode [inherited]
enum ReadState
Enumerator:
RSInitial 
RSReading 
RSComplete 
RSError 
enum seekdir [inherited]
Enumerator:
beg 
cur 
end 

Member Function Documentation

bool bad ( ) [inherited]
clear ( ) [inherited]
close ( )

Reimplemented from SSReader.

bool eof ( ) [inherited]
bool fail ( ) [inherited]
int get ( ) [inherited]
ReadState getReadState ( )
int getTcpHeaderSize ( ) [inherited]

Returns the header size for datagrams.

See set_tcp_header_size().

Reimplemented in SocketStream.

bool good ( ) [inherited]
bool isClosed ( )

Reimplemented from SSReader.

bool receiveDatagram ( Datagram  dg) [inherited]

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.

seekg ( unsigned long int  pos) [inherited]
seekg ( long int  off,
seekdir  dir 
) [inherited]
setTcpHeaderSize ( int  tcp_header_size) [inherited]

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.

Reimplemented in SocketStream.

unsigned long int tellg ( ) [inherited]
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties