AXCEL C++ Framework
Elegance through abstraction
Public Member Functions | Public Attributes
axcel::net::socket::udp Class Reference

User Datagram Protocol socket. More...

#include <axcel.h>

Inheritance diagram for axcel::net::socket::udp:
axcel::object

List of all members.

Public Member Functions

 udp ()
 ~udp ()
virtual string type ()
 Get type of object.
virtual operator string ()
 Convert to string.
int post (dgram dg)
 Send datagram.
net::dgram get ()
 Get datagram.
bool bind (const char *port)
 Bind to port.
void unbind ()
 Unbind from port.
int check ()
 Get size of next packet.

Public Attributes

int fd

Detailed Description

User Datagram Protocol socket.

Definition at line 960 of file axcel.h.


Constructor & Destructor Documentation

axcel::net::socket::udp::udp ( )

Definition at line 4461 of file axcel.cpp.

axcel::net::socket::udp::~udp ( )

Definition at line 4469 of file axcel.cpp.


Member Function Documentation

bool axcel::net::socket::udp::bind ( const char *  port)

Bind to port.

Parameters:
portPort or service name
Returns:
true on success, false on failure

Assigns the specified port to this socket to prepare it for receiving packets. If a udp socket is not bound to a local address, the socket layer will automatically assign a free local port and bind the socket ot INADDR_ANY.

Definition at line 4349 of file axcel.cpp.

int axcel::net::socket::udp::check ( )

Get size of next packet.

Returns:
Size of next packet or -1 if no packet available

Definition at line 4494 of file axcel.cpp.

net::dgram axcel::net::socket::udp::get ( )

Get datagram.

Returns:
Received datagram

Reads a datagram from this socket. The net::dgram object contains the peer ip address object, port number, and data object containing the datagram data. If no datagram is available, this method blocks until one can be read.

Definition at line 4397 of file axcel.cpp.

axcel::net::socket::udp::operator string ( ) [virtual]

Convert to string.

Returns:
Suitable string representation of object's data

Implements axcel::object.

Definition at line 4523 of file axcel.cpp.

int axcel::net::socket::udp::post ( net::dgram  dg)

Send datagram.

Parameters:
dgdatagram object
Returns:
Number of bytes sent

Sends datagram dg through this socket. The dg object contains the data, ip address, and port to send to.

Definition at line 4382 of file axcel.cpp.

string axcel::net::socket::udp::type ( ) [virtual]

Get type of object.

Returns:
string containing name of object's class.

Implements axcel::object.

Definition at line 4522 of file axcel.cpp.

void axcel::net::socket::udp::unbind ( )

Unbind from port.

"Unbinds" this socket from a port by closing the socket fs::file descriptor, and creating a new socket to assign to this object.

Definition at line 4367 of file axcel.cpp.


Member Data Documentation

Definition at line 965 of file axcel.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines