Inheritance diagram for Socket:
Public Member Functions | |
this (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) |
Socket | accept () |
void | shutdown () |
void | shutdown (Shutdown how) |
void | setLingerPeriod (int period) |
void | setAddressReuse (bool enabled) |
bool | setGroup (InternetAddress address, Option option) |
void | closure () |
bit | poll (events) |
Static Public 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) |
Protected Member Functions | |
this (socket_t sock) | |
void | set (socket_t sock) |
void | reset () |
void | create (AddressFamily af, Type type, Protocol protocol) |
Socket | createSocket (socket_t handle) |
Private Member Functions | |
Address | newFamilyObject () |
Address | remoteAddress () |
Address | localAddress () |
int | send (void[] buf, Flags flags=Flags.NONE) |
int | sendTo (void[] buf, Flags flags, Address to) |
int | sendTo (void[] buf, Address to) |
int | sendTo (void[] buf, Flags flags=Flags.NONE) |
int | receive (void[] buf, Flags flags=Flags.NONE) |
int | receiveFrom (void[] buf, Flags flags, out Address from) |
int | receiveFrom (void[] buf, out Address from) |
int | receiveFrom (void[] buf, Flags flags) |
int | receiveFrom (void[] buf) |
int | getOption (OptionLevel level, Option option, void[] result) |
void | setOption (OptionLevel level, Option option, void[] value) |
this () | |
Object | getLock () |
void | setLock (Object lock) |
void | acquire () |
bool | acquireIfOpen () |
void | close () |
Static Private Member Functions | |
static char[] | hostName () |
static uint | hostAddress () |
Private Attributes | |
socket_t | sock |
AddressFamily | _family |
public class VersionWin32 bit | _blocking = false |
Object | _lock |
Static Private Attributes | |
static bool | cancelled |
Definition at line 474 of file Socket.d.
|
Construct a Socket from a handle. This is used internally to create new Sockets via an accept(). Reimplemented in SocketConduit. Definition at line 492 of file Socket.d. References set(). |
|
MANGO: moved this out from the above constructor so that it can be called from the FreeList version of SocketConduit Definition at line 505 of file Socket.d. References Resource::acquire(). Referenced by SocketConduit::VersionUseFreeList::allocate(), and this(). |
|
MANGO: added to reset socket Definition at line 519 of file Socket.d. References INVALID_SOCKET. Referenced by SocketConduit::VersionUseFreeList::deallocate(). |
|
MANGO: added for subscriber control Definition at line 533 of file Socket.d. References cancelled. |
|
MANGO: added for subscriber control |
|
Definition at line 856 of file Socket.d. References Resource::acquire(), and create(). |
|
MANGO: added for multicast support Definition at line 871 of file Socket.d. Referenced by ServerSocket::createSocket(), MulticastSocket::leave(), and this(). |
|
get underlying socket handle Definition at line 886 of file Socket.d. References sock. Referenced by blocking(), and setGroup(). |
|
|
|
getter Definition at line 909 of file Socket.d. References _blocking, handle(), and version. Referenced by connect(). |
|
setter Definition at line 928 of file Socket.d. References _blocking, handle(), sock, SOCKET_ERROR, version, and x. |
|
Definition at line 959 of file Socket.d. References _family. |
|
Definition at line 970 of file Socket.d. References sock, and SOCKET_ERROR. |
|
Definition at line 982 of file Socket.d. References Address::name(), Address::nameLen(), sock, and SOCKET_ERROR. Referenced by MulticastSocket::join(), and ServerSocket::this(). |
|
Definition at line 994 of file Socket.d. References assert(), blocking(), Address::name(), Address::nameLen(), sock, SOCKET_ERROR, and version. Referenced by HttpClient::open(), SocketAppender::setAddress(), testClient(), testClusterServer(), testHttpClient(), testHttpClient2(), and testSocket(). |
|
need to bind() first Definition at line 1026 of file Socket.d. References sock, and SOCKET_ERROR. Referenced by ServerSocket::this(). |
|
MANGO: added Reimplemented in ServerSocket. Definition at line 1038 of file Socket.d. References Socket. Referenced by accept(). |
|
Reimplemented in ServerSocket. Definition at line 1048 of file Socket.d. References _blocking, _family, createSocket(), INVALID_SOCKET, sock, and version. Referenced by ServerSocket::accept(). |
|
Definition at line 1074 of file Socket.d. References sock. Referenced by HttpClient::close(), and shutdown(). |
|
Definition at line 1084 of file Socket.d. References shutdown(), and sock. |
|
MANGO: added Reimplemented in ServerSocket. Definition at line 1096 of file Socket.d. References setOption(). Referenced by ServerSocket::createSocket(). |
|
MANGO: added Definition at line 1114 of file Socket.d. References setOption(), and x. Referenced by MulticastSocket::join(), and ServerSocket::this(). |
|
Helper function to handle the adding and dropping of group membership. MANGO: Added Definition at line 1130 of file Socket.d. References handle(), InternetAddress::sin, and SOCKET_ERROR. |
|
calling shutdown() before this is recommended for connection- oriented sockets MANGO: changed from close() to IResource.closure() Reimplemented from Resource. Definition at line 1155 of file Socket.d. References printf(), sock, and version. Referenced by MulticastSocket::leave(). |
|
Definition at line 1182 of file Socket.d. References _family. Referenced by localAddress(), receiveFrom(), and remoteAddress(). |
|
Mango: added this to return the hostname Definition at line 1204 of file Socket.d. References SOCKET_ERROR, and strlen(). Referenced by hostAddress(). |
|
Mango: added this to return the default host address (IPv4) Definition at line 1220 of file Socket.d. References InternetHost::addrList, assert(), InternetHost::getHostByName(), and hostName(). |
|
Definition at line 1236 of file Socket.d. References _family, Address::addressFamily(), assert(), Address::name(), Address::nameLen(), newFamilyObject(), sock, and SOCKET_ERROR. |
|
Definition at line 1252 of file Socket.d. References _family, Address::addressFamily(), assert(), Address::name(), Address::nameLen(), newFamilyObject(), sock, and SOCKET_ERROR. |
|
returns number of bytes actually sent, or -1 on error Definition at line 1269 of file Socket.d. References sock. Referenced by SocketConduit::write(). |
|
-to- is ignored if connected ? Definition at line 1282 of file Socket.d. References Address::name(), Address::nameLen(), and sock. Referenced by sendTo(). |
|
-to- is ignored if connected ? Definition at line 1295 of file Socket.d. References sendTo(). |
|
assumes you connect()ed Definition at line 1307 of file Socket.d. References sock. |
|
returns number of bytes actually received, 0 on connection closure, or -1 on error Definition at line 1321 of file Socket.d. References read, sock, and SOCKET_ERROR. Referenced by SocketConduit::read(). |
|
-from- is ignored if connected ? Definition at line 1339 of file Socket.d. References _family, assert(), Address::nameLen(), newFamilyObject(), printf(), read, sock, SOCKET_ERROR, and version. Referenced by receiveFrom(). |
|
-from- is ignored if connected ? Definition at line 1369 of file Socket.d. References receiveFrom(). |
|
assumes you connect()ed Definition at line 1381 of file Socket.d. References read, sock, and SOCKET_ERROR. |
|
assumes you connect()ed Definition at line 1399 of file Socket.d. References receiveFrom(). |
|
returns the length, in bytes, of the actual result - very different from getsockopt() Definition at line 1412 of file Socket.d. References sock, and SOCKET_ERROR. |
|
Definition at line 1426 of file Socket.d. References sock, and SOCKET_ERROR. Referenced by setAddressReuse(), setLingerPeriod(), and MulticastSocket::setLoopback(). |
|
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 1460 of file Socket.d. References assert(). Referenced by poll(), and SocketConduit::read(). |
|
|
|
maximum timeout |
|
Definition at line 1540 of file Socket.d. References select(). |
|
Set the default lock to be this object Reimplemented in DatagramSocket, and SocketConduit. Definition at line 77 of file Resource.d. References Resource::_lock. |
|
Return the lock used by this resource Reimplemented from IResource. Definition at line 104 of file Resource.d. References Resource::_lock. |
|
Set an alternate lock. Typically one would use this to synchronize multiple different Resource via a common object. Reimplemented from IResource. Definition at line 118 of file Resource.d. References assert(). |
|
hold a reference to this resource. The caller is now responsible for invoking close() upon this resource; Reimplemented from IResource. Definition at line 133 of file Resource.d. References Resource::_lock, and Resource::usage. Referenced by set(), this(), FileConduit::this(), and DeviceConduit::this(). |
|
If this resource is still open, acquire it and return true. This is a threadsafe test-and-set mechanism that fails only if the resource is already closed, or was never opened. Note that you are responsible for invoking close() whenever this method returns true. Reimplemented from IResource. Definition at line 152 of file Resource.d. References Resource::_lock, and Resource::usage. |
|
release a reference to this resource Reimplemented from IResource. Definition at line 171 of file Resource.d. References Resource::_lock, Resource::closure(), and Resource::usage. Referenced by Resource::~this(). |
|
Definition at line 477 of file Socket.d. Referenced by accept(), bind(), blocking(), closure(), connect(), create(), getOption(), handle(), isAlive(), listen(), localAddress(), receive(), receiveFrom(), remoteAddress(), send(), sendTo(), setOption(), and shutdown(). |
|
Definition at line 478 of file Socket.d. Referenced by accept(), addressFamily(), create(), localAddress(), newFamilyObject(), receiveFrom(), and remoteAddress(). |
|
Definition at line 479 of file Socket.d. Referenced by cancelAll(), and isCancelled(). |
|
Definition at line 482 of file Socket.d. Referenced by accept(), and blocking(). |
|
Definition at line 54 of file Resource.d. Referenced by Resource::acquire(), Resource::acquireIfOpen(), Resource::close(), Resource::getLock(), and Resource::this(). |