Panda3D
|
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...
#include "socket_tcp.h"
Public Member Functions | |
Socket_TCP (SOCKET) | |
bool | ActiveOpen (const Socket_Address &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. | |
bool | ActiveOpenNonBlocking (const Socket_Address &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) | |
int | DontLinger () |
Turn off the linger flag. | |
bool | ErrorIs_WouldBlocking (int err) |
virtual TypeHandle | force_init_type () |
virtual TypeHandle | get_type () const |
std::string | RecvData (int max_len) |
Read the data from the connection. | |
int | RecvData (char *data, int size) |
Read the data from the connection. | |
int | SendData (const char *data, int size) |
Ok Lets Send the Data. | |
int | SendData (const std::string &str) |
int | SetLinger (int interval_seconds=0) |
will control the behavior of SO_LINGER for a TCP socket | |
int | SetNoDelay (bool flag=true) |
Disable Nagle algorithm. | |
int | SetSendBufferSize (int insize) |
Just like it sounds. | |
bool | ShutdownSend () |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. |
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.
Definition at line 15 of file socket_tcp.h.
bool Socket_TCP::ActiveOpen | ( | const Socket_Address & | theaddress, |
bool | setdelay | ||
) | [inline] |
This function will try and set the socket up for active open to a specified address and port provided by the input parameter.
Definition at line 131 of file socket_tcp.h.
References SetNoDelay().
bool Socket_TCP::ActiveOpenNonBlocking | ( | const Socket_Address & | theaddress | ) | [inline] |
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)
Definition at line 152 of file socket_tcp.h.
References Socket_IP::SetNonBlocking(), and Socket_IP::SetReuseAddress().
int Socket_TCP::DontLinger | ( | ) | [inline] |
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.
Definition at line 102 of file socket_tcp.h.
Referenced by Connection::set_linger().
static void Socket_TCP::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from Socket_IP.
Reimplemented in Buffered_DatagramConnection, HttpConnection, and Http_Request.
Definition at line 42 of file socket_tcp.h.
References Socket_IP::init_type().
int Socket_TCP::RecvData | ( | char * | data, |
int | len | ||
) | [inline] |
Read the data from the connection.
Return type : int
Definition at line 195 of file socket_tcp.h.
std::string Socket_TCP::RecvData | ( | int | max_len | ) | [inline] |
Read the data from the connection.
Return type : int
Definition at line 210 of file socket_tcp.h.
int Socket_TCP::SendData | ( | const char * | data, |
int | size | ||
) | [inline] |
Ok Lets Send the Data.
Return type : int
Definition at line 181 of file socket_tcp.h.
int Socket_TCP::SetLinger | ( | int | interval_seconds = 0 | ) | [inline] |
will control the behavior of SO_LINGER for a TCP socket
Definition at line 84 of file socket_tcp.h.
Referenced by Connection::set_linger().
int Socket_TCP::SetNoDelay | ( | bool | flag = true | ) | [inline] |
Disable Nagle algorithm.
Don't delay send to coalesce packets
Definition at line 68 of file socket_tcp.h.
Referenced by ActiveOpen(), and Connection::set_no_delay().
int Socket_TCP::SetSendBufferSize | ( | int | insize | ) | [inline] |
Just like it sounds.
Sets a buffered socket recv buffer size. This function does not refuse ranges outside hard-coded OS limits
Definition at line 119 of file socket_tcp.h.
Referenced by Connection::set_send_buffer_size().