tango.net.device.Berkeley

int strlen(char*) [private, extern(C)] #
enum #
enum SocketOption #
enum SocketOptionLevel #
enum SocketType #
STREAM #
sequential, reliable
DGRAM #
connectionless unreliable, max length
SEQPACKET #
sequential, reliable, max length
enum ProtocolType #
IP #
default internet protocol (probably 4 for compatibility)
IPV4 #
internet protocol version 4
IPV6 #
internet protocol version 6
ICMP #
internet control message protocol
IGMP #
internet group management protocol
TCP #
transmission control protocol
PUP #
PARC universal packet protocol
UDP #
user datagram protocol
IDP #
Xerox NS protocol
enum AddressFamily #
enum SocketShutdown #
enum SocketFlags #
OOB #
out of band
PEEK #
only for receiving
DONTROUTE #
only for sending
NOSIGNAL #
inhibit signals
struct Berkeley [public] #
void open(AddressFamily family, SocketType type, ProtocolType protocol, bool create = true) #
Configure this instance
void reopen(socket_t sock = sock.init) #
Open/reopen a native socket for this instance
void detach() #
calling shutdown() before this is recommended for connection- oriented sockets
socket_t handle() #
Return the underlying OS handle of this Conduit
int lastError() [static] #
Return the last error
bool isAlive() #
Is this socket still alive? A closed socket is considered to be dead, but a shutdown socket is still alive.
AddressFamily addressFamily() #
Berkeley* bind(Address addr) #
Berkeley* connect(Address to) #
Berkeley* listen(int backlog) #
need to bind() first
void accept(ref Berkeley target) #
need to bind() first
Berkeley* shutdown(SocketShutdown how) #
The shutdown function shuts down the connection of the socket. Depending on the argument value, it will:
- stop receiving data for this socket. If further data arrives, it is rejected.

- stop trying to transmit data from this socket. Also discards any data waiting to be sent. Stop looking for acknowledgement of data already sent; don't retransmit if any data is lost.

Berkeley* linger(int period) #
set linger timeout
Berkeley* addressReuse(bool enabled) #
enable/disable address reuse
Berkeley* noDelay(bool enabled) #
enable/disable noDelay option (nagle)
void joinGroup(IPv4Address address, bool onOff) #
Helper function to handle the adding and dropping of group membership.
Address newFamilyObject() #
char[] hostName() [static] #
return the hostname
uint hostAddress() [static] #
return the default host address (IPv4)
Address remoteAddress() #
return the remote address of the current connection (IPv4)
Address localAddress() #
return the local address of the current connection (IPv4)
int send(void[] buf, SocketFlags flags = SocketFlags.NONE) #
Send data on the connection. Returns the number of bytes actually sent, or ERROR on failure. If the socket is blocking and there is no buffer space left, send waits.
Returns number of bytes actually sent, or -1 on error
int sendTo(void[] buf, SocketFlags flags, Address to) #
int sendTo(void[] buf, Address to) #
Send data to a specific destination Address. If the destination address is not specified, a connection must have been made and that address is used. If the socket is blocking and there is no buffer space left, sendTo waits.
int sendTo(void[] buf, SocketFlags flags = SocketFlags.NONE) #
ditto - assumes you connect()ed
int sendTo(void[] buf, int flags, Address.sockaddr* to, int len) [private] #
Send data to a specific destination Address. If the destination address is not specified, a connection must have been made and that address is used. If the socket is blocking and there is no buffer space left, sendTo waits.
int receive(void[] buf, SocketFlags flags = SocketFlags.NONE) #
Receive data on the connection. Returns the number of bytes actually received, 0 if the remote side has closed the connection, or ERROR on failure. If the socket is blocking, receive waits until there is data to be received. Returns number of bytes actually received, 0 on connection closure, or -1 on error
int receiveFrom(void[] buf, SocketFlags flags, Address from) #
int receiveFrom(void[] buf, Address from) #
Receive data and get the remote endpoint Address. Returns the number of bytes actually received, 0 if the remote side has closed the connection, or ERROR on failure. If the socket is blocking, receiveFrom waits until there is data to be received.
int receiveFrom(void[] buf, SocketFlags flags = SocketFlags.NONE) #
ditto - assumes you connect()ed
int getOption(SocketOptionLevel level, SocketOption option, void[] result) #
returns the length, in bytes, of the actual result - very different from getsockopt()
Berkeley* setOption(SocketOptionLevel level, SocketOption option, void[] value) #
bool blocking() #
getter
void blocking(bool yes) #
setter
void exception(char[] msg) [static] #
void badArg(char[] msg) [protected, static] #
class Address [public, abstract] #
ushort ntohs(ushort x) [private, static] #
Internal usage
uint ntohl(uint x) [private, static] #
Internal usage
char[] convert2D(char* s) [private, static] #
Internal usage
char* convert2C(char[] input, char[] output) [private, static] #
Internal usage
char[] fromInt(char[] tmp, int i) [private, static] #
Internal usage
void exception(char[] msg) [static] #

Tango:

added this common function
class UnknownAddress : Address [public] #
sockaddr* name() #
int nameLen() #
AddressFamily addressFamily() #
char[] toString() #
class IPv4Address : Address [public] #
enum #
struct sockaddr_in #
this() [package] #
this(ushort port) #
this(uint addr, ushort port) #
this(char[] addr, int port = PORT_ANY) #
-port- can be PORT_ANY -addr- is an IP address or host name
sockaddr* name() #
int nameLen() #
AddressFamily addressFamily() #
ushort port() #
uint addr() #
char[] toAddrString() [synchronized] #
char[] toPortString() #
char[] toString() #
uint parse(char[] addr) [static] #
-addr- is an IP address in the format "a.b.c.d" returns ADDR_NONE on failure
class NetHost [public] #
struct hostent #
void validHostent(hostent* he) [protected] #
void populate(hostent* he) #
bool getHostByName(char[] name) #
bool getHostByAddr(uint addr) #
bool getHostByAddr(char[] addr) #
class SocketSet [public] #
a set of sockets for Berkeley.select()
int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, timeval* tv) [public, static] #
SocketSet's are updated to include only those sockets which an event occured.
Returns the number of events, 0 on timeout, or -1 on error

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
int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, long microseconds) [public, static] #
select with specified timeout
int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError) [public, static] #
select with maximum timeout