zenilib
0.5.3.0
|
A TCP Socket for sending and receiving data. More...
#include <Net.h>
Public Member Functions | |
TCP_Socket (IPaddress ip) | |
For outgoing connections. More... | |
TCP_Socket (TCPsocket sock) | |
For incoming connections. More... | |
~TCP_Socket () | |
int | check_socket () |
IPaddress | peer_address () const |
int | receive (void *const &data, const Uint16 &num_bytes) |
int | receive (String &data, const Uint16 &num_bytes) |
void | send (const void *const &data, const Uint16 &num_bytes) |
void | send (const String &data) |
int | try_check_socket () |
int | try_receive (void *const &data, const Uint16 &num_bytes) |
Receive up to num_bytes. More... | |
int | try_receive (String &data, const Uint16 &num_bytes) |
int | try_send (const void *const &data, const Uint16 &num_bytes) |
Send data. More... | |
int | try_send (const String &data) |
A TCP Socket for sending and receiving data.
This class not only provides a TCP socket but prevents receive calls from blocking as well.
Contact: bazal d@ze nipex .com
Zeni::TCP_Socket::TCP_Socket | ( | IPaddress | ip | ) |
For outgoing connections.
Definition at line 76 of file Net.cpp.
References Zeni::get_Net(), IPaddress::host, Zeni::Singleton< TYPE >::lend_pre_uninit(), SDLNet_AllocSocketSet(), SDLNet_FreeSocketSet(), SDLNet_TCP_AddSocket(), SDLNet_TCP_Close(), and SDLNet_TCP_Open().
Zeni::TCP_Socket::TCP_Socket | ( | TCPsocket | sock | ) |
For incoming connections.
Definition at line 108 of file Net.cpp.
References Zeni::get_Net(), Zeni::Singleton< TYPE >::lend_pre_uninit(), SDLNet_AllocSocketSet(), SDLNet_TCP_AddSocket(), and SDLNet_TCP_Close().
Zeni::TCP_Socket::~TCP_Socket | ( | ) |
Definition at line 135 of file Net.cpp.
References Zeni::Singleton< Net >::remove_pre_uninit(), SDLNet_FreeSocketSet(), SDLNet_TCP_Close(), and SDLNet_TCP_DelSocket().
int Zeni::TCP_Socket::check_socket | ( | ) |
IPaddress Zeni::TCP_Socket::peer_address | ( | ) | const |
Definition at line 145 of file Net.cpp.
References SDLNet_TCP_GetPeerAddress().
Definition at line 212 of file Net.cpp.
References try_receive().
Definition at line 170 of file Net.cpp.
References try_send().
Definition at line 175 of file Net.cpp.
References try_send().
int Zeni::TCP_Socket::try_check_socket | ( | ) |
Definition at line 149 of file Net.cpp.
References SDLNet_CheckSockets().
Referenced by check_socket().
Receive up to num_bytes.
Definition at line 180 of file Net.cpp.
References check_socket(), and SDLNet_TCP_Recv().
Referenced by receive().
Definition at line 192 of file Net.cpp.
References Zeni::String::c_str(), receive(), and Zeni::String::resize().
Send data.
Definition at line 162 of file Net.cpp.
References SDLNet_TCP_Send().
Referenced by send(), and try_send().
Definition at line 166 of file Net.cpp.
References Zeni::String::c_str(), Zeni::String::size(), and try_send().