Panda3D
Public Member Functions | Static Public Member Functions | List of all members
SocketTCP Class Reference

Base functionality for a TCP connected socket This class is pretty useless by itself but it does hide some of the platform differences from machine to machine. More...

Inheritance diagram for SocketTCP:
SocketIP TypedObject BufferedDatagramConnection

Public Member Functions

 __init__ ()
 
 __init__ (SOCKET)
 
bool ActiveOpen (const SocketAddress theaddress, bool setdelay)
 This function will try and set the socket up for active open to a specified address and port provided by the input parameter. More...
 
bool ActiveOpenNonBlocking (const SocketAddress theaddress)
 This function will try and set the socket up for active open to a specified address and port provided by the input parameter (non-blocking version) More...
 
int DontLinger ()
 Turn off the linger flag. More...
 
bool ErrorIsWouldBlocking (int err)
 
str RecvData (int max_len)
 Read the data from the connection - if error 0 if socket closed for read or length is 0 + bytes read (May be smaller than requested) More...
 
int SendData (str str)
 
int SetLinger (int interval_seconds)
 will control the behavior of SO_LINGER for a TCP socket More...
 
int SetNoDelay (bool flag)
 Disable Nagle algorithm. More...
 
int SetSendBufferSize (int insize)
 Just like it sounds. More...
 
bool ShutdownSend ()
 
- Public Member Functions inherited from SocketIP
 __init__ ()
 Def Constructor. More...
 
 __init__ (SOCKET in)
 Assigns an existing socket to this class. More...
 
bool Active ()
 Ask if the socket is open (allocated) More...
 
 Close ()
 Closes a socket if it is open (allocated). More...
 
SocketAddress GetPeerName ()
 Wrapper on berkly getpeername... More...
 
SOCKET GetSocket ()
 Gets the base socket type. More...
 
SOCKET GetSocket ()
 Get The RAW file id of the socket. More...
 
int SetBlocking ()
 Set the socket to block on subsequent calls to socket functions that address this socket. More...
 
int SetNonBlocking ()
 this function will throw a socket into non-blocking mode More...
 
int SetRecvBufferSize (int size)
 Ok it sets the recv buffer size for both tcp and UDP. More...
 
bool SetReuseAddress (bool flag)
 Informs a socket to reuse IP address as needed. More...
 
 SetSocket (SOCKET ins)
 Assigns an existing socket to this class. More...
 
bool SetV6Only (bool flag)
 Sets a flag indicating whether this IPv6 socket should operate in dual-stack mode or not. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from SocketIP
static TypeHandle getClassType ()
 
static int GetLastError ()
 Gets the last errcode from a socket operation. More...
 
static int InitNetworkDriver ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 

Additional Inherited Members

- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 

Detailed Description

Base functionality for a TCP connected socket This class is pretty useless by itself but it does hide some of the platform differences from machine to machine.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( SOCKET  )

◆ ActiveOpen()

bool ActiveOpen ( const SocketAddress  theaddress,
bool  setdelay 
)

This function will try and set the socket up for active open to a specified address and port provided by the input parameter.

◆ ActiveOpenNonBlocking()

bool ActiveOpenNonBlocking ( const SocketAddress  theaddress)

This function will try and set the socket up for active open to a specified address and port provided by the input parameter (non-blocking version)

◆ DontLinger()

int DontLinger ( )

Turn off the linger flag.

The socket will quickly release buffered items and free up OS resources. You may lose a stream if you use this flag and do not negotiate the close at the application layer.

◆ ErrorIsWouldBlocking()

bool ErrorIsWouldBlocking ( int  err)

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ RecvData()

str RecvData ( int  max_len)

Read the data from the connection - if error 0 if socket closed for read or length is 0 + bytes read (May be smaller than requested)

◆ SendData()

int SendData ( str  str)

◆ SetLinger()

int SetLinger ( int  interval_seconds)

will control the behavior of SO_LINGER for a TCP socket

◆ SetNoDelay()

int SetNoDelay ( bool  flag)

Disable Nagle algorithm.

Don't delay send to coalesce packets

◆ SetSendBufferSize()

int SetSendBufferSize ( int  insize)

Just like it sounds.

Sets a buffered socket recv buffer size. This function does not refuse ranges outside hard-coded OS limits

◆ ShutdownSend()

bool ShutdownSend ( )