zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Zeni::TCP_Socket Class Reference

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)
 

Detailed Description

A TCP Socket for sending and receiving data.

This class not only provides a TCP socket but prevents receive calls from blocking as well.

Author
bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 151 of file Net.h.

Constructor & Destructor Documentation

Zeni::TCP_Socket::TCP_Socket ( TCPsocket  sock)
Zeni::TCP_Socket::~TCP_Socket ( )

Member Function Documentation

int Zeni::TCP_Socket::check_socket ( )

Definition at line 153 of file Net.cpp.

References try_check_socket().

Referenced by try_receive().

IPaddress Zeni::TCP_Socket::peer_address ( ) const

Definition at line 145 of file Net.cpp.

References SDLNet_TCP_GetPeerAddress().

int Zeni::TCP_Socket::receive ( void *const data,
const Uint16 num_bytes 
)

Definition at line 203 of file Net.cpp.

References try_receive().

Referenced by try_receive().

int Zeni::TCP_Socket::receive ( String data,
const Uint16 num_bytes 
)

Definition at line 212 of file Net.cpp.

References try_receive().

void Zeni::TCP_Socket::send ( const void *const data,
const Uint16 num_bytes 
)

Definition at line 170 of file Net.cpp.

References try_send().

void Zeni::TCP_Socket::send ( const String data)

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().

int Zeni::TCP_Socket::try_receive ( void *const data,
const Uint16 num_bytes 
)

Receive up to num_bytes.

Definition at line 180 of file Net.cpp.

References check_socket(), and SDLNet_TCP_Recv().

Referenced by receive().

int Zeni::TCP_Socket::try_receive ( String data,
const Uint16 num_bytes 
)

Definition at line 192 of file Net.cpp.

References Zeni::String::c_str(), receive(), and Zeni::String::resize().

int Zeni::TCP_Socket::try_send ( const void *const data,
const Uint16 num_bytes 
)

Send data.

Definition at line 162 of file Net.cpp.

References SDLNet_TCP_Send().

Referenced by send(), and try_send().

int Zeni::TCP_Socket::try_send ( const String data)

Definition at line 166 of file Net.cpp.

References Zeni::String::c_str(), Zeni::String::size(), and try_send().


The documentation for this class was generated from the following files: