PTLib
Version 2.10.4
|
A socket channel that uses the UDP transport on the Internet Protocol. More...
#include <udpsock.h>
Public Member Functions | |
Construction | |
PUDPSocket (WORD port=0, int iAddressFamily=AF_INET) | |
Create a UDP socket. | |
PUDPSocket (PQoS *qos, WORD port=0, int iAddressFamily=AF_INET) | |
PUDPSocket (const PString &service, PQoS *qos=NULL, int iAddressFamily=AF_INET) | |
PUDPSocket (const PString &address, WORD port) | |
PUDPSocket (const PString &address, const PString &service) | |
Overrides from class PSocket | |
PBoolean | Read (void *buf, PINDEX len) |
Override of PChannel functions to allow connectionless reads. | |
PBoolean | Write (const void *buf, PINDEX len) |
Override of PChannel functions to allow connectionless writes. | |
PBoolean | Connect (const PString &address) |
Override of PSocket functions to allow connectionless writes. | |
Protected Member Functions | |
virtual PBoolean | OpenSocket () |
virtual PBoolean | OpenSocket (int ipAdressFamily) |
Open an IPv4 or IPv6 socket. | |
virtual PBoolean | OpenSocketGQOS (int af, int type, int proto) |
virtual PBoolean | ApplyQoS () |
virtual const char * | GetProtocolName () const |
This function returns the protocol name for the socket type. | |
Protected Attributes | |
Address | sendAddress |
WORD | sendPort |
Address | lastReceiveAddress |
WORD | lastReceivePort |
PQoS | qosSpec |
New functions for class | |
void | SetSendAddress (const Address &address, WORD port) |
Set the address to use for connectionless Write() or Windows QoS. | |
void | GetSendAddress (Address &address, WORD &port) const |
Get the address to use for connectionless Write(). | |
PString | GetSendAddress () const |
void | GetLastReceiveAddress (Address &address, WORD &port) const |
Get the address of the sender in the last connectionless Read(). | |
PString | GetLastReceiveAddress () const |
virtual PBoolean | IsAlternateAddress (const Address &address, WORD port) |
CallBack to check if the detected address of the connectionless Read() is an alternate address. | |
virtual PBoolean | DoPseudoRead (int &selectStatus) |
PseudoRead This indicates to the upper system that reading on this socket will be a pseudo read when means there is data available that did not orginate from the physical socket but was programmically injected. | |
virtual PBoolean | ModifyQoSSpec (PQoS *qos) |
Change the QOS spec for the socket and try to apply the changes. | |
virtual PQoS & | GetQoSSpec () |
Get the QOS object for the socket. | |
static PBoolean | SupportQoS (const PIPSocket::Address &address) |
Check to See if the socket will support QoS on the given local Address. | |
static void | EnableGQoS () |
Manually Enable GQoS Support. |
A socket channel that uses the UDP transport on the Internet Protocol.
PUDPSocket::PUDPSocket | ( | WORD | port = 0 , |
int | iAddressFamily = AF_INET |
||
) |
Create a UDP socket.
If a remote machine address or a "listening" socket is specified then the channel is also opened.
port | Port number to use for the connection. |
iAddressFamily | Family |
PUDPSocket::PUDPSocket | ( | PQoS * | qos, |
WORD | port = 0 , |
||
int | iAddressFamily = AF_INET |
||
) |
qos | Pointer to a QOS structure for the connection |
port | Port number to use for the connection. |
iAddressFamily | Family |
PUDPSocket::PUDPSocket | ( | const PString & | service, |
PQoS * | qos = NULL , |
||
int | iAddressFamily = AF_INET |
||
) |
service | Service name to use for the connection. |
qos | Pointer to a QOS structure for the connection |
iAddressFamily | Family |
PUDPSocket::PUDPSocket | ( | const PString & | address, |
WORD | port | ||
) |
address | Address of remote machine to connect to. |
port | Port number to use for the connection. |
PUDPSocket::PUDPSocket | ( | const PString & | address, |
const PString & | service | ||
) |
address | Address of remote machine to connect to. |
service | Service name to use for the connection. |
virtual PBoolean PUDPSocket::ApplyQoS | ( | ) | [protected, virtual] |
PBoolean PUDPSocket::Connect | ( | const PString & | address | ) | [virtual] |
Override of PSocket functions to allow connectionless writes.
address | Address of remote machine to connect to. |
Reimplemented from PIPSocket.
Reimplemented in PSocksUDPSocket.
virtual PBoolean PUDPSocket::DoPseudoRead | ( | int & | selectStatus | ) | [virtual] |
PseudoRead This indicates to the upper system that reading on this socket will be a pseudo read when means there is data available that did not orginate from the physical socket but was programmically injected.
static void PUDPSocket::EnableGQoS | ( | ) | [static] |
Manually Enable GQoS Support.
void PUDPSocket::GetLastReceiveAddress | ( | Address & | address, |
WORD & | port | ||
) | const |
Get the address of the sender in the last connectionless Read().
Note that thsi only applies to the Read() and not the ReadFrom() function.
address | IP address to send packets. |
port | Port to send packets. |
PString PUDPSocket::GetLastReceiveAddress | ( | ) | const |
virtual const char* PUDPSocket::GetProtocolName | ( | ) | const [protected, virtual] |
This function returns the protocol name for the socket type.
Implements PSocket.
virtual PQoS& PUDPSocket::GetQoSSpec | ( | ) | [virtual] |
Get the QOS object for the socket.
void PUDPSocket::GetSendAddress | ( | Address & | address, |
WORD & | port | ||
) | const |
Get the address to use for connectionless Write().
address | IP address to send packets. |
port | Port to send packets. |
PString PUDPSocket::GetSendAddress | ( | ) | const |
virtual PBoolean PUDPSocket::IsAlternateAddress | ( | const Address & | address, |
WORD | port | ||
) | [virtual] |
CallBack to check if the detected address of the connectionless Read() is an alternate address.
Use this to switch the target to send and receive the connectionless read/write.
address | Detected IP Address. |
port | Detected Port. |
virtual PBoolean PUDPSocket::ModifyQoSSpec | ( | PQoS * | qos | ) | [virtual] |
Change the QOS spec for the socket and try to apply the changes.
qos | QoS specification to use |
virtual PBoolean PUDPSocket::OpenSocket | ( | ) | [protected, virtual] |
Implements PSocket.
virtual PBoolean PUDPSocket::OpenSocket | ( | int | ipAdressFamily | ) | [protected, virtual] |
Open an IPv4 or IPv6 socket.
Implements PIPSocket.
virtual PBoolean PUDPSocket::OpenSocketGQOS | ( | int | af, |
int | type, | ||
int | proto | ||
) | [protected, virtual] |
PBoolean PUDPSocket::Read | ( | void * | buf, |
PINDEX | len | ||
) | [virtual] |
void PUDPSocket::SetSendAddress | ( | const Address & | address, |
WORD | port | ||
) |
Set the address to use for connectionless Write() or Windows QoS.
address | IP address to send packets. |
port | Port to send packets. |
static PBoolean PUDPSocket::SupportQoS | ( | const PIPSocket::Address & | address | ) | [static] |
Check to See if the socket will support QoS on the given local Address.
PBoolean PUDPSocket::Write | ( | const void * | buf, |
PINDEX | len | ||
) | [virtual] |
Address PUDPSocket::lastReceiveAddress [protected] |
WORD PUDPSocket::lastReceivePort [protected] |
PQoS PUDPSocket::qosSpec [protected] |
Address PUDPSocket::sendAddress [protected] |
WORD PUDPSocket::sendPort [protected] |