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

ServerSocket Class Reference

Inheritance diagram for ServerSocket:

Socket List of all members.

Public Member Functions

 this (InternetAddress addr, int backlog, bool socketReuse=false)
void setLingerPeriod (int period)
SocketConduit accept ()

Protected Member Functions

override Socket createSocket (socket_t handle)

Private Member Functions

 this (socket_t sock)
 this (AddressFamily af, Type type, Protocol protocol)
 this ()
void set (socket_t sock)
void reset ()
void create (AddressFamily af, Type type, 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)
void shutdown ()
void shutdown (Shutdown how)
void setAddressReuse (bool enabled)
bool setGroup (InternetAddress address, Option option)
void closure ()
bit poll (events)

Static Private Member Functions

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

Private Attributes

int linger = -1

Detailed Description

ServerSocket is a wrapper upon the basic socket functionality to simplify the API somewhat. You use a ServerSocket to listen for inbound connection requests, and get back a SocketConduit when a connection is made.

Definition at line 58 of file ServerSocket.d.


Member Function Documentation

this InternetAddress  addr,
int  backlog,
bool  socketReuse = false
[inline]
 

Construct a ServerSocket on the given address, with the specified number of backlog connections supported. The socket is bound to the given address, and set to listen for incoming connections. Note that the socket address can be setup for reuse, so that a halted server may be restarted immediately.

Definition at line 73 of file ServerSocket.d.

References Socket::bind(), Socket::listen(), and Socket::setAddressReuse().

void setLingerPeriod int  period  )  [inline]
 

Set the period in which dead sockets are left lying around by the O/S

Reimplemented from Socket.

Definition at line 88 of file ServerSocket.d.

References linger.

SocketConduit accept  )  [inline]
 

Wait for a client to connect to us, and return a connected SocketConduit.

Reimplemented from Socket.

Definition at line 100 of file ServerSocket.d.

References Socket::accept().

Referenced by ServerThread::run().

override Socket createSocket socket_t  handle  )  [inline, protected]
 

Overrides the default socket behaviour to create a socket for an incoming connection. Here we provide a SocketConduit instead.

Reimplemented from Socket.

Definition at line 113 of file ServerSocket.d.

References Socket::create(), linger, and Socket::setLingerPeriod().

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 505 of file Socket.d.

References Socket::set().

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

Definition at line 799 of file Socket.d.

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

this  )  [inline, inherited]
 

Set the default lock to be this object

Reimplemented in DatagramSocket, and SocketConduit.

Definition at line 77 of file Resource.d.

References Resource::_lock.

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 518 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 532 of file Socket.d.

References INVALID_SOCKET.

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

static bool isCancelled  )  [inline, static, inherited]
 

MANGO: added for subscriber control

Definition at line 546 of file Socket.d.

References Socket::cancelled.

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

MANGO: added for subscriber control

Definition at line 557 of file Socket.d.

References Socket::cancelled, and version.

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

MANGO: added for multicast support

Definition at line 814 of file Socket.d.

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

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

socket_t handle  )  [inline, inherited]
 

get underlying socket handle

Definition at line 829 of file Socket.d.

References Socket::sock.

Referenced by Socket::blocking(), and Socket::setGroup().

char [] toString  )  [inline, inherited]
 

Definition at line 840 of file Socket.d.

bit blocking  )  [inline, inherited]
 

getter

Definition at line 852 of file Socket.d.

References Socket::_blocking, Socket::handle(), and version.

Referenced by Socket::connect().

void blocking bit  byes  )  [inline, inherited]
 

setter

Definition at line 871 of file Socket.d.

References Socket::_blocking, Socket::handle(), Socket::sock, SOCKET_ERROR, and version.

AddressFamily addressFamily  )  [inline, inherited]
 

Definition at line 902 of file Socket.d.

References Socket::_family.

bit isAlive  )  [inline, inherited]
 

Definition at line 913 of file Socket.d.

References Socket::sock, and SOCKET_ERROR.

void bind Address  addr  )  [inline, inherited]
 

Definition at line 925 of file Socket.d.

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

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

void connect Address  to  )  [inline, inherited]
 

Definition at line 937 of file Socket.d.

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

Referenced by HttpClient::open(), SocketAppender::setAddress(), testClient(), testClusterServer(), testHttpClient(), testHttpClient2(), and testSocket().

void listen int  backlog  )  [inline, inherited]
 

need to bind() first

Definition at line 969 of file Socket.d.

References Socket::sock, and SOCKET_ERROR.

Referenced by this().

void shutdown  )  [inline, inherited]
 

Definition at line 1017 of file Socket.d.

References Socket::sock.

Referenced by HttpClient::close(), and Socket::shutdown().

void shutdown Shutdown  how  )  [inline, inherited]
 

Definition at line 1027 of file Socket.d.

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

void setAddressReuse bool  enabled  )  [inline, inherited]
 

MANGO: added

Definition at line 1057 of file Socket.d.

References Socket::setOption().

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

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

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

MANGO: Added

Definition at line 1073 of file Socket.d.

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

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 1098 of file Socket.d.

References Socket::sock, and version.

Referenced by MulticastSocket::leave().

static 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 1403 of file Socket.d.

References assert().

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

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

Definition at line 1456 of file Socket.d.

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

maximum timeout

Definition at line 1471 of file Socket.d.

bit poll events   )  [inline, inherited]
 

Definition at line 1483 of file Socket.d.

References Socket::select().


Member Data Documentation

int linger = -1 [private]
 

Definition at line 60 of file ServerSocket.d.

Referenced by createSocket(), and setLingerPeriod().


The documentation for this class was generated from the following file:
Generated on Fri May 27 18:12:03 2005 for Mango by  doxygen 1.4.0