Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

DatagramSocket Class Reference

Inheritance diagram for DatagramSocket:

Socket ISocketReader MulticastSocket List of all members.

Public Member Functions

 this ()
int read (IBuffer target, Address addr)
int read (IBuffer target)
int write (IBuffer source, Address to)

Private Member Functions

 this (socket_t sock)
 this (Socket.AddressFamily af, Socket.Type type, Socket.Protocol protocol)
void set (socket_t sock)
void reset ()
void create (Socket.AddressFamily af, Socket.Type type, Socket.Protocol protocol)
socket_t handle ()
char[] toString ()
bit blocking ()
void blocking (bit byes)
AddressFamily addressFamily ()
bit isAlive ()
void bind (Address addr)
void connect (Address to)
void listen (int backlog)
Socket createSocket (socket_t handle)
Socket accept ()
void shutdown ()
void shutdown (Socket.Shutdown how)
void setLingerPeriod (int period)
void setAddressReuse (bool enabled)
bool setGroup (InternetAddress address, Socket.Option option)
void closure ()
bit poll (events)

Static Private Member Functions

bool isCancelled ()
void cancelAll (bool cancel)
int select (SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, timeval *tv)
int select (SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, int microseconds)
int select (SocketSet checkRead, SocketSet checkWrite, SocketSet checkError)

Detailed Description

Wrapper around datagram style of sockets, to simplify the API a bit, and to tie them into the IBuffer construct.

Note that when used with a SocketListener you must first bind the DatagramSocket to a local adapter. This can be done by binding it to an InternetAddress constructed with a port only (ADDR_ANY).

Definition at line 58 of file DatagramSocket.d.


Member Function Documentation

this  )  [inline]
 

Create an internet datagram socket

Reimplemented from Resource.

Definition at line 66 of file DatagramSocket.d.

int read IBuffer  target,
Address  addr
[inline]
 

Read the available bytes from datagram into the given IBuffer. The 'from' address will be populated appropriately

Definition at line 78 of file DatagramSocket.d.

References assert().

Referenced by read().

int read IBuffer  target  )  [inline]
 

Read the available bytes from datagram into the given IBuffer. The 'from' address will be populated appropriately

Reimplemented from ISocketReader.

Definition at line 100 of file DatagramSocket.d.

References read().

int write IBuffer  source,
Address  to
[inline]
 

Write content from the specified buffer to the given address.

Definition at line 113 of file DatagramSocket.d.

References assert().

Referenced by Cluster::broadcast().

this socket_t  sock  )  [inline, protected, inherited]
 

Construct a Socket from a handle. This is used internally to create new Sockets via an accept().

Reimplemented in SocketConduit.

Definition at line 498 of file Socket.d.

References Socket::set(), and Socket::sock.

this Socket.AddressFamily  af,
Socket.Type  type,
Socket.Protocol  protocol
[inline, inherited]
 

Definition at line 792 of file Socket.d.

References Resource::acquire(), and Socket::create().

void set socket_t  sock  )  [inline, protected, inherited]
 

MANGO: moved this out from the above constructor so that it can be called from the FreeList version of SocketConduit

Definition at line 511 of file Socket.d.

References Resource::acquire().

Referenced by SocketConduit::VersionUseFreeList::allocate(), and Socket::this().

void reset  )  [inline, protected, inherited]
 

MANGO: added to reset socket

Definition at line 525 of file Socket.d.

References INVALID_SOCKET.

Referenced by SocketConduit::VersionUseFreeList::deallocate().

bool isCancelled  )  [inline, static, inherited]
 

MANGO: added for subscriber control

Definition at line 539 of file Socket.d.

References Socket::cancelled.

void cancelAll bool  cancel  )  [inline, static, inherited]
 

MANGO: added for subscriber control

Definition at line 550 of file Socket.d.

References Socket::cancelled, and version.

void create Socket.AddressFamily  af,
Socket.Type  type,
Socket.Protocol  protocol
[inline, protected, inherited]
 

MANGO: added for multicast support

Definition at line 807 of file Socket.d.

References Socket::_family, and Socket::sock.

Referenced by ServerSocket::createSocket(), MulticastSocket::leave(), and Socket::this().

socket_t handle  )  [inline, inherited]
 

get underlying socket handle

Definition at line 822 of file Socket.d.

References Socket::sock.

Referenced by Socket::setGroup().

char [] toString  )  [inline, inherited]
 

Definition at line 833 of file Socket.d.

bit blocking  )  [inline, inherited]
 

getter

Definition at line 845 of file Socket.d.

References Socket::_blocking, and version.

void blocking bit  byes  )  [inline, inherited]
 

setter

Definition at line 864 of file Socket.d.

References Socket::_blocking, Socket::sock, SOCKET_ERROR, and version.

AddressFamily addressFamily  )  [inline, inherited]
 

Definition at line 895 of file Socket.d.

References Socket::_family.

bit isAlive  )  [inline, inherited]
 

Definition at line 906 of file Socket.d.

References Socket::sock, and SOCKET_ERROR.

void bind Address  addr  )  [inline, inherited]
 

Definition at line 918 of file Socket.d.

References Address::name(), Address::nameLen(), Socket::sock, and SOCKET_ERROR.

Referenced by MulticastSocket::join(), and ServerSocket::this().

void connect Address  to  )  [inline, inherited]
 

Definition at line 930 of file Socket.d.

References assert(), Address::name(), Address::nameLen(), Socket::sock, SOCKET_ERROR, and version.

Referenced by HttpClient::open(), and ConnectionPool::PoolConnection::reset().

void listen int  backlog  )  [inline, inherited]
 

need to bind() first

Definition at line 962 of file Socket.d.

References Socket::sock, and SOCKET_ERROR.

Referenced by ServerSocket::this().

Socket createSocket socket_t  handle  )  [inline, protected, inherited]
 

MANGO: added

Reimplemented in ServerSocket.

Definition at line 974 of file Socket.d.

References Socket.

Referenced by Socket::accept().

Socket accept  )  [inline, inherited]
 

Reimplemented in ServerSocket.

Definition at line 984 of file Socket.d.

References Socket::_blocking, Socket::_family, Socket::createSocket(), INVALID_SOCKET, Socket::sock, and version.

Referenced by ServerSocket::accept().

void shutdown  )  [inline, inherited]
 

Definition at line 1010 of file Socket.d.

References Socket::sock.

Referenced by HttpClient::close().

void shutdown Socket.Shutdown  how  )  [inline, inherited]
 

Definition at line 1020 of file Socket.d.

References Socket::sock.

void setLingerPeriod int  period  )  [inline, inherited]
 

MANGO: added

Reimplemented in ServerSocket.

Definition at line 1032 of file Socket.d.

References Socket::setOption().

Referenced by ServerSocket::createSocket().

void setAddressReuse bool  enabled  )  [inline, inherited]
 

MANGO: added

Definition at line 1050 of file Socket.d.

References Socket::setOption().

Referenced by MulticastSocket::join(), and ServerSocket::this().

bool setGroup InternetAddress  address,
Socket.Option  option
[inline, inherited]
 

Helper function to handle the adding and dropping of group membership.

MANGO: Added

Definition at line 1066 of file Socket.d.

References Socket::handle(), InternetAddress::sin, and SOCKET_ERROR.

Referenced by MulticastSocket::pauseGroup(), and MulticastSocket::resumeGroup().

void closure  )  [inline, inherited]
 

calling shutdown() before this is recommended for connection- oriented sockets

MANGO: changed from close() to IResource.closure()

Reimplemented from Resource.

Definition at line 1091 of file Socket.d.

References Socket::sock, and version.

Referenced by MulticastSocket::leave().

int select SocketSet  checkRead,
SocketSet  checkWrite,
SocketSet  checkError,
timeval *  tv
[inline, static, inherited]
 

SocketSet's are updated to include only those sockets which an event occured.

Returns the number of events, 0 on timeout, or -1 on interruption

for a connect()ing socket, writeability means connected for a listen()ing socket, readability means listening

Winsock: possibly internally limited to 64 sockets per set

Definition at line 1396 of file Socket.d.

References assert().

Referenced by Socket::poll(), and SocketConduit::reader().

int select SocketSet  checkRead,
SocketSet  checkWrite,
SocketSet  checkError,
int  microseconds
[inline, static, inherited]
 

Definition at line 1449 of file Socket.d.

int select SocketSet  checkRead,
SocketSet  checkWrite,
SocketSet  checkError
[inline, static, inherited]
 

maximum timeout

Definition at line 1464 of file Socket.d.

bit poll events   )  [inline, inherited]
 

Definition at line 1476 of file Socket.d.

References Socket::select().


The documentation for this class was generated from the following file:
Generated on Sat Apr 9 20:11:36 2005 for Mango by doxygen 1.3.6