All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----java.net.Socket
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.
String
.
protected Socket()
protected Socket(SocketImpl impl) throws SocketException
The impl parameter is an instance of a SocketImpl the subclass wishes to use on the Socket.
public Socket(String host,
int port) throws UnknownHostException, IOException
If the application has specified a server socket factory, that
factory's createSocketImpl
method is called to create
the actual socket implementation. Otherwise a "plain" socket is created.
public Socket(InetAddress address,
int port) throws IOException
If the application has specified a socket factory, that factory's
createSocketImpl
method is called to create the
actual socket implementation. Otherwise a "plain" socket is created.
public Socket(String host,
int port,
InetAddress localAddr,
int localPort) throws IOException
public Socket(InetAddress address,
int port,
InetAddress localAddr,
int localPort) throws IOException
public Socket(String host,
int port,
boolean stream) throws IOException
If the stream argument is true
, this creates a
stream socket. If the stream argument is false
, it
creates a datagram socket.
If the application has specified a server socket factory, that
factory's createSocketImpl
method is called to create
the actual socket implementation. Otherwise a "plain" socket is created.
boolean
indicating whether this is
a stream socket or a datagram socket.
public Socket(InetAddress host,
int port,
boolean stream) throws IOException
If the stream argument is true
, this creates a
stream socket. If the stream argument is false
, it
creates a datagram socket.
If the application has specified a server socket factory, that
factory's createSocketImpl
method is called to create
the actual socket implementation. Otherwise a "plain" socket is created.
true
, create a stream socket;
otherwise, create a datagram socket.
public InetAddress getInetAddress()
public InetAddress getLocalAddress()
public int getPort()
public int getLocalPort()
public InputStream getInputStream() throws IOException
public OutputStream getOutputStream() throws IOException
public void setTcpNoDelay(boolean on) throws SocketException
public boolean getTcpNoDelay() throws SocketException
public void setSoLinger(boolean on,
int val) throws SocketException
public int getSoLinger() throws SocketException
public synchronized void setSoTimeout(int timeout) throws SocketException
public synchronized int getSoTimeout() throws SocketException
public synchronized void close() throws IOException
public String toString()
String
.
public static synchronized void setSocketImplFactory(SocketImplFactory fac) throws IOException
When an application creates a new client socket, the socket
implementation factory's createSocketImpl
method is
called to create the actual socket implementation.
All Packages Class Hierarchy This Package Previous Next Index