GNet::DatagramSocket Class Reference

A derivation of Socket for a connectionless datagram socket. More...

#include <gsocket.h>

Inheritance diagram for GNet::DatagramSocket:

GNet::Socket

List of all members.

Public Member Functions

 DatagramSocket ()
 Default constructor.
 DatagramSocket (const Address &address_hint)
 Constructor with a hint of a local address.
virtual ~DatagramSocket ()
 Destructor.
ssize_type read (void *buffer, size_type len, Address &src)
 Reads a datagram and returns the sender's address by reference.
ssize_type write (const char *buffer, size_type len, const Address &dst)
 Sends a datagram to the given address.
ssize_type write (const char *buffer, size_type len)
 See Socket::write().
void disconnect ()
 Releases the association between two datagram endpoints reversing the effect of the previous Socket::connect().


Detailed Description

A derivation of Socket for a connectionless datagram socket.

Definition at line 314 of file gsocket.h.


Constructor & Destructor Documentation

GNet::DatagramSocket::DatagramSocket (  ) 

Default constructor.

Definition at line 370 of file gsocket.cpp.

GNet::DatagramSocket::DatagramSocket ( const Address address_hint  )  [explicit]

Constructor with a hint of a local address.

Definition at line 375 of file gsocket.cpp.

GNet::DatagramSocket::~DatagramSocket (  )  [virtual]

Destructor.

Definition at line 380 of file gsocket.cpp.


Member Function Documentation

GNet::Socket::ssize_type GNet::DatagramSocket::read ( void *  buffer,
size_type  len,
Address src 
)

Reads a datagram and returns the sender's address by reference.

If connect() has been used then only datagrams from the address specified in the connect() call will be received.

Definition at line 391 of file gsocket.cpp.

References GNet::Socket::m_reason, GNet::Socket::m_socket, GNet::Socket::reason(), and GNet::Socket::sizeError().

GNet::Socket::ssize_type GNet::DatagramSocket::write ( const char *  buffer,
size_type  len,
const Address dst 
)

Sends a datagram to the given address.

This form of write() should be used if there is no connect() assocation in effect.

Definition at line 406 of file gsocket.cpp.

References GNet::Address::address(), GNet::Address::displayString(), G_DEBUG, GNet::Address::length(), GNet::Socket::m_reason, GNet::Socket::m_socket, and GNet::Socket::reason().

GNet::Socket::ssize_type GNet::DatagramSocket::write ( const char *  buffer,
size_type  len 
) [inline]

See Socket::write().

Definition at line 354 of file gsocket.h.

References GNet::Socket::write().

void GNet::DatagramSocket::disconnect (  ) 

Releases the association between two datagram endpoints reversing the effect of the previous Socket::connect().

Definition at line 384 of file gsocket.cpp.

References GNet::Socket::connect(), GNet::Socket::error(), GNet::Socket::m_reason, GNet::Socket::m_socket, and GNet::Socket::reason().


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5