#include <tnlUDP.h>
Public Types | |
| enum | { DefaultBufferSize = 32768 } |
Public Methods | |
| Socket (const Address &bindAddress, U32 sendBufferSize=DefaultBufferSize, U32 recvBufferSize=DefaultBufferSize, bool acceptsBroadcast=true, bool nonblockingIO=true) | |
| Opens a socket on the specified address/port. | |
| ~Socket () | |
| Closes the socket. | |
| bool | isValid () |
| Returns true if the socket was created successfully. | |
| NetError | sendto (const Address &address, const U8 *buffer, S32 bufferSize) |
| Sends a packet to the address through sourceSocket. | |
| NetError | recvfrom (Address *address, U8 *buffer, S32 bufferSize, S32 *bytesRead) |
| Read an incoming packet. | |
| Address | getBoundAddress () |
| Returns the Address corresponding to this socket, as bound on the local machine. | |
Static Public Methods | |
| void | getInterfaceAddresses (Vector< Address > *addressVector) |
| Returns the list of network addresses this host can be bound to. | |
Definition at line 149 of file tnlUDP.h.
|
|
|
|
||||||||||||||||||||||||
|
Opens a socket on the specified address/port. A connectPort of 0 will bind to any available port. Passing a valid address for ipBindInterface will attempt to bind this socket to a particular IP address on the local machine. Definition at line 207 of file udp.cpp. References TNL::IPProtocol, TNL::IPXProtocol, TNL::TCPProtocol, TNL::Address::toString(), TNL::Address::transport, and TNL::U32. |
|
|
Returns the list of network addresses this host can be bound to. Currently this only returns IP addresses, with the port field set to 0. |
|
||||||||||||||||||||
|
Read an incoming packet.
Definition at line 347 of file udp.cpp. References TNL::NetError, TNL::Address::netNum, TNL::NoError, TNL::Address::port, TNL::Address::transport, TNL::U8, and TNL::WouldBlock. Referenced by TNL::PacketStream::recvfrom(). |
1.2.18