# Socket_TCP

from pandac.PandaModules import Socket_TCP

Class : Socket_TCP
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

## Inheritance:

Socket_TCP: Socket_IP
Socket_IP: TypedObject
TypedObject: MemoryBase
MemoryBase:

## Methods of Socket_TCP:

SocketTCP (Constructor)
ActiveOpen
ActiveOpenNonBlocking
DontLinger
ErrorIsWouldBlocking
getClassType
RecvData
SendData
SetLinger
SetNoDelay
SetSendBufferSize
ShutdownSend

## Methods of Socket_IP:

SocketIP (Constructor)
Active
Close
getClassType
GetLastError
GetPeerName
GetSocket
InitNetworkDriver
SetBlocking
SetNonBlocking
SetRecvBufferSize
SetReuseAddress
SetSocket

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

SocketTCP Socket_TCP::Socket_TCP(int ); Function name : Socket_TCP::Socket_TCP Description :

ActiveOpen bool Socket_TCP::ActiveOpen(Socket_Address const &theaddress, bool setdelay); inline bool ActiveOpen(const Socket_Address & theaddress); Function name : ActiveOpen Description : 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 Socket_TCP::ActiveOpenNonBlocking(Socket_Address const &theaddress); inline bool ActiveOpen(const Socket_Address & theaddress); Function name : ActiveOpenNonBlocking Description : 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 Socket_TCP::DontLinger(void); Function name : Socket_TCP::DontLinger Description : 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 Socket_TCP::ErrorIs_WouldBlocking(int err); Undocumented function.

getClassType static TypeHandle Socket_TCP::get_class_type(void); Undocumented function.

RecvData string Socket_TCP::RecvData(int max_len); inline int RecvData( std::string &str, int max_len); Function name : Socket_TCP::RecvData Description : Read the data from the connection Return type : int - if error 0 if socket closed for read or length is 0 + bytes read ( May be smaller than requested)

SendData int Socket_TCP::SendData(string const &str); Function name : Socket_TCP::SendData Description : Ok Lets Send the Data Return type : int - if error 0 if socket closed for write or lengh is 0 + bytes writen ( May be smaller than requested)

SetLinger int Socket_TCP::SetLinger(int interval_seconds = (0)); Function name : SetLinger Description : will control the behavior of SO_LINGER for a TCP socket

SetNoDelay int Socket_TCP::SetNoDelay(bool flag = (1)); Function name : SetNoDelay Description : Disable Nagle algorithm. Don't delay send to coalesce packets

SetSendBufferSize int Socket_TCP::SetSendBufferSize(int insize); Function name : SetSendBufferSize Description : Just like it sounds. Sets a buffered socket recv buffer size. This function does not refuse ranges outside hard-coded OS limits

ShutdownSend bool Socket_TCP::ShutdownSend(void); Undocumented function.

SocketIP Socket_IP::Socket_IP(void); Function name : Socket_IP::Socket_IP Description : Def Constructor Function name : Socket_IP::SetSocket Description : Assigns an existing socket to this class

Active bool Socket_IP::Active(void); Function name : Socket_IP::Active Description : Ask if the socket is open (allocated)

Close void Socket_IP::Close(void); Function name : Socket_IP::Close Description : closes a socket if it is open (allocated)

getClassType static TypeHandle Socket_IP::get_class_type(void); Undocumented function.

GetLastError static int Socket_IP::GetLastError(void); Function name : Socket_IP::GetLastError Description : gets the last errcode from a socket operation

GetPeerName Socket_Address Socket_IP::GetPeerName(void) const; Function name : Socket_IP::GetPeerName Description : Wrapper on berkly getpeername...

GetSocket int Socket_IP::GetSocket(void); Function name : Socket_IP::GetSocket Description : Gets the base socket type Description : Get The RAW file id of the socket

InitNetworkDriver static int Socket_IP::InitNetworkDriver(void); Undocumented function.

SetBlocking int Socket_IP::SetBlocking(void); Function name : Socket_IP::SetBlocking Description : Set the socket to block on subsequent calls to socket functions that address this socket

SetNonBlocking int Socket_IP::SetNonBlocking(void); Function name : SetNonBlocking Description : this function will throw a socket into non-blocking mode

SetRecvBufferSize int Socket_IP::SetRecvBufferSize(int size); Function name : Socket_IP::SetRecvBufferSize Description : Ok it sets the recv buffer size for both tcp and UDP

SetReuseAddress bool Socket_IP::SetReuseAddress(bool flag = (1)); Function name : SetReuseAddress Description : Informs a socket to reuse IP address as needed

SetSocket void Socket_IP::SetSocket(int ins); Function name : Socket_IP::SetSocket Description : Assigns an existing socket to this class

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.