public class DefaultSocket extends Object implements SocketInterface
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.
This socket interface allows usage of an SSL Socket on the client side that is dynamically defined in the applet parameters.
Constructor and Description |
---|
DefaultSocket(Phantom phantom,
Proxy proxy,
URI uri)
Constructor for the default socket.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this socket.
|
void |
createSocket()
Creates a stream socket and connects it to the specified port number
on the named host.
|
InetAddress |
getInetAddress()
Returns the address to which the socket is connected.
|
InputStream |
getInputStream()
Returns an input stream for this socket.
|
InetAddress |
getLocalAddress()
Gets the local address to which the socket is bound.
|
Socket |
getMainSocket()
Gets the main socket used for the interface (for SSL, this is
the SSL socket, for others, it's the normal socket).
|
OutputStream |
getOutputStream()
Returns an output stream for this socket.
|
Socket |
getPlainSocket()
Gets the plain socket used for the interface.
|
void |
setTimeout(int value)
Sets the send timeout SO_TIMEOUT value.
|
public void createSocket() throws UnknownHostException, IOException
createSocket
in interface SocketInterface
IOException
- if an I/O error occurs when creating the socket.UnknownHostException
public Socket getPlainSocket()
getPlainSocket
in interface SocketInterface
public Socket getMainSocket()
getMainSocket
in interface SocketInterface
public void setTimeout(int value)
setTimeout
in interface SocketInterface
public InetAddress getInetAddress()
getInetAddress
in interface SocketInterface
public InetAddress getLocalAddress()
getLocalAddress
in interface SocketInterface
public InputStream getInputStream() throws IOException
getInputStream
in interface SocketInterface
IOException
- if an I/O error occurs when creating the input stream.public OutputStream getOutputStream() throws IOException
getOutputStream
in interface SocketInterface
IOException
- if an I/O error occurs when creating the input stream.public void close() throws IOException
close
in interface SocketInterface
IOException
- if an I/O error occurs when closing this socket.Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.