zenilib
0.5.3.0
|
A UDP Socket for sending and receiving data. More...
#include <Net.h>
Inherited by Zeni::Split_UDP_Socket.
Public Member Functions | |
UDP_Socket (const Uint16 &port) | |
virtual | ~UDP_Socket () |
IPaddress | peer_address () const |
Apparently only works if the port was explicitly specified. More... | |
virtual int | receive (IPaddress &ip, const void *const &data, const Uint16 &num_bytes) |
Receive data of up to data.size() from the returned IPaddress; Will error if num_bytes/data.size() is too low. More... | |
virtual int | receive (IPaddress &ip, String &data) |
virtual void | send (const IPaddress &ip, const void *const &data, const Uint16 &num_bytes) |
Send data to an IPaddress. More... | |
virtual void | send (const IPaddress &ip, const String &data) |
A UDP Socket for sending and receiving data.
UDP Sockets are little more than a lock on a given port on a computer. A program that might need a dozen TCP Sockets can get by with one UDP_Socket. Note that if you opt to use UDP_Sockets, you'll get faster data transmission at the expense of reliability. If all the data being transmitted has to get there, you're better off using TCP_Sockets, even if the order of arrival is unimportant. Code carefully.
Contact: bazal d@ze nipex .com
Definition at line 274 of file Net.cpp.
References Zeni::get_Net(), Zeni::Singleton< TYPE >::lend_pre_uninit(), and SDLNet_UDP_Open().
|
virtual |
Definition at line 294 of file Net.cpp.
References Zeni::Singleton< Net >::remove_pre_uninit(), and SDLNet_UDP_Close().
IPaddress Zeni::UDP_Socket::peer_address | ( | ) | const |
Apparently only works if the port was explicitly specified.
Definition at line 301 of file Net.cpp.
References SDLNet_UDP_GetPeerAddress().
|
virtual |
Receive data of up to data.size() from the returned IPaddress; Will error if num_bytes/data.size() is too low.
Reimplemented in Zeni::Split_UDP_Socket.
Definition at line 330 of file Net.cpp.
References UDPpacket::address, IPaddress::host, UDPpacket::len, IPaddress::port, and SDLNet_UDP_Recv().
Referenced by receive(), and Zeni::Split_UDP_Socket::receive().
Reimplemented in Zeni::Split_UDP_Socket.
Definition at line 356 of file Net.cpp.
References Zeni::String::c_str(), receive(), Zeni::String::resize(), and Zeni::String::size().
|
virtual |
Send data to an IPaddress.
Reimplemented in Zeni::Split_UDP_Socket.
Definition at line 305 of file Net.cpp.
References SDLNet_UDP_Send(), and u.
Referenced by send(), and Zeni::Split_UDP_Socket::send().
Reimplemented in Zeni::Split_UDP_Socket.
Definition at line 326 of file Net.cpp.
References Zeni::String::c_str(), send(), and Zeni::String::size().