Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

socket Class Reference

Inherits iohandle.

Inherited by tcpsocket.

List of all members.


Detailed Description

A network socket descriptor.

This class will be expanded to include socket-specific I/O methods.


Public Types

enum  flags { none = 0, nonblocking = 1, acceptor = 2 }

Public Methods

 socket ()
 Null constructor.

 socket (const iohandle &ioh)
 Constructs a socket from a given iohandle.

status stat ()
 Updates the socket error state if there's no current error (useful after a connect).

address getpeername ()
 Returns the peer name of the socket, if any.

address getsockname ()
 Returns the local name of the socket, if any.

status bind (const address &a)
 Attempts to bind the socket.

status connect (const address &a)
 Attempts to connect the socket.

status listen (int backlog=5)
 Listens on the socket.

socket accept (address &a)
 Attempts to accept a connection on the socket.


Static Public Methods

int sys_socket (int a, int b, int c)

Protected Methods

 socket (int fd)
 socket (int family, int type)
 socket (int family, int type, address addr, flags f=none)


Member Enumeration Documentation

enum socket::flags
 

Enumeration values:
none 
nonblocking 
acceptor 


Constructor & Destructor Documentation

socket::socket (  int    fd )  [protected]
 

socket::socket (  int    family,
int    type
)  [protected]
 

socket::socket (  int    family,
int    type,
address    addr,
flags    f = none
)  [protected]
 

socket::socket (    ) 
 

Null constructor.

socket::socket (  const iohandle &    ioh ) 
 

Constructs a socket from a given iohandle.


Member Function Documentation

socket socket::accept (  address &    a ) 
 

Attempts to accept a connection on the socket.

status socket::bind (  const address &    a ) 
 

Attempts to bind the socket.

status socket::connect (  const address &    a ) 
 

Attempts to connect the socket.

address socket::getpeername (    ) 
 

Returns the peer name of the socket, if any.

address socket::getsockname (    ) 
 

Returns the local name of the socket, if any.

status socket::listen (  int    backlog = 5 ) 
 

Listens on the socket.

status socket::stat (    ) 
 

Updates the socket error state if there's no current error (useful after a connect).

Returns true if there is no error on the socket.

int socket::sys_socket (  int    a,
int    b,
int    c
)  [static]
 


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:10 2002 for NMSTL