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

ServerSocket Class Reference

#include <ServerSocket.h>

Inheritance diagram for ServerSocket:

Inheritance graph
[legend]
Collaboration diagram for ServerSocket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ServerSocket (int port)
 Create server socket.
 ServerSocket ()
virtual ~ServerSocket ()
 Destroy server socket.
const ServerSocketoperator<< (const std::string &) const
 Send string to client.
const ServerSocketoperator>> (std::string &) const
 Receive string from cleint.
void accept (ServerSocket &)
 Accept server socket.

Private Member Functions

bool create ()
 Create socket.
bool bind (const int port)
 Bind socket.
bool listen () const
 Listen to socket.
bool accept (Socket &) const
 Accept socket.
bool connect (const std::string host, const int port)
 Connect to the host.
bool send (const std::string) const
 Send string to socket.
int recv (std::string &) const
 Receive string from socket.
void set_non_blocking (const bool)
 Set non blocking.
bool is_valid () const

Constructor & Destructor Documentation

ServerSocket::ServerSocket int  port  ) 
 

Create server socket.

Parameters:
port is the open port on the server
Returns:
throw SocketException if error

Definition at line 28 of file ServerSocket.cpp.

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

ServerSocket::ServerSocket  )  [inline]
 

Definition at line 30 of file ServerSocket.h.

ServerSocket::~ServerSocket  )  [virtual]
 

Destroy server socket.

Definition at line 50 of file ServerSocket.cpp.


Member Function Documentation

bool Socket::accept Socket new_socket  )  const [inherited]
 

Accept socket.

Parameters:
new_socket 

Definition at line 116 of file Socket.cpp.

References Socket::m_sock.

Referenced by accept().

void ServerSocket::accept ServerSocket sock  ) 
 

Accept server socket.

Parameters:
sock 

Definition at line 89 of file ServerSocket.cpp.

References Socket::accept().

bool Socket::bind const int  port  )  [inherited]
 

Bind socket.

Parameters:
port is the port to communicate with.

Definition at line 68 of file Socket.cpp.

References Socket::is_valid(), and Socket::m_addr.

Referenced by ServerSocket().

bool Socket::connect const std::string  host,
const int  port
[inherited]
 

Connect to the host.

Parameters:
host is the IP address (xxx.xxx.xxx.xxx) or host name (vt.edu)
port is the port number for the host

Definition at line 187 of file Socket.cpp.

References Socket::is_valid(), and Socket::m_addr.

Referenced by ClientSocket::Connect().

bool Socket::create  )  [inherited]
 

Create socket.

Definition at line 46 of file Socket.cpp.

References Socket::is_valid(), and Socket::m_sock.

Referenced by ClientSocket::Connect(), and ServerSocket().

bool Socket::is_valid  )  const [inline, inherited]
 

Definition at line 65 of file Socket.h.

Referenced by Socket::bind(), Socket::connect(), Socket::create(), Socket::listen(), and Socket::~Socket().

bool Socket::listen  )  const [inherited]
 

Listen to socket.

Definition at line 94 of file Socket.cpp.

References Socket::is_valid().

Referenced by ServerSocket().

const ServerSocket & ServerSocket::operator<< const std::string &  str  )  const
 

Send string to client.

Parameters:
str sting of data to send
Returns:
throw SocketException if error

Definition at line 59 of file ServerSocket.cpp.

References Socket::send().

const ServerSocket & ServerSocket::operator>> std::string &  str  )  const
 

Receive string from cleint.

Parameters:
str sting of data to send
Returns:
throw SocketException if error

Definition at line 75 of file ServerSocket.cpp.

References Socket::recv().

int Socket::recv std::string &  str  )  const [inherited]
 

Receive string from socket.

Parameters:
str is the string of data to be received
Returns:
status

Definition at line 155 of file Socket.cpp.

References MAXRECV.

Referenced by operator>>(), and ClientSocket::operator>>().

bool Socket::send const std::string  str  )  const [inherited]
 

Send string to socket.

Parameters:
str is the string of data to be sent

Definition at line 136 of file Socket.cpp.

Referenced by operator<<(), and ClientSocket::operator<<().

void Socket::set_non_blocking const   bool  )  [inherited]
 

Set non blocking.

Parameters:
b 

Definition at line 218 of file Socket.cpp.

References Socket::m_sock.


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 12:54:42 2007 for DSACSS Operational Code by  doxygen 1.3.9.1