Socket Class Reference

Inheritance diagram for Socket:

Inheritance graph
[legend]
Collaboration diagram for Socket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Socket (InetAddress address, int port)
 Socket (InetAddress address, int port, InetAddress localAddr, int localPort)
 Socket (const String &host, int port)
 Socket (const String &host, int port, InetAddress localAddr, int localPort)
void close ()
InetAddress getInetAddress () const
int getLocalPort () const
int getPort () const
SocketOutputStreamPtr getOutputStream ()
SocketInputStreamPtr getInputStream ()

Protected Member Functions

 Socket ()
 Socket (SocketImplPtr impl)

Detailed Description

This class implements client sockets (also called just "sockets"). A socket is an endpoint for communication between two machines.

The actual work of the socket is performed by an instance of the SocketImpl class. An application, by changing the socket factory that creates the socket implementation, can configure itself to create sockets appropriate to the local firewall.


Constructor & Destructor Documentation

Socket  )  [protected]
 

Creates an unconnected socket.

Socket InetAddress  address,
int  port
 

Creates a stream socket and connects it to the specified port number at the specified IP address.

Socket InetAddress  address,
int  port,
InetAddress  localAddr,
int  localPort
 

Creates a socket and connects it to the specified remote address on the specified remote port.

Socket SocketImplPtr  impl  )  [protected]
 

Creates an unconnected Socket with a user-specified SocketImpl.

Socket const String &  host,
int  port
 

Creates a stream socket and connects it to the specified port number on the named host.

Socket const String &  host,
int  port,
InetAddress  localAddr,
int  localPort
 

Creates a socket and connects it to the specified remote host on the specified remote port.


Member Function Documentation

void close  )  [inline]
 

Closes this socket.

InetAddress getInetAddress  )  const [inline]
 

Returns the value of this socket's address field.

SocketInputStreamPtr getInputStream  ) 
 

Returns an input stream for this socket.

int getLocalPort  )  const [inline]
 

Returns the value of this socket's localport field.

SocketOutputStreamPtr getOutputStream  ) 
 

Returns an output stream for this socket.

int getPort  )  const [inline]
 

Returns the value of this socket's port field.


The documentation for this class was generated from the following files:
  • socket.h
  • socket.cpp

Copyright © 1999-2004, Apache Software Foundation