|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.ihmc.mockets.StreamMocket
public class StreamMocket
The Mocket class represents an endpoint of a mobile socket connection. The class is designed to be a drop-in replacement for the Socket class in the Java Platform API.
Nested Class Summary | |
---|---|
class |
StreamMocket.Statistics
The Statistics class is used to retrieve statistics about the current mocket connection. |
Constructor Summary | |
---|---|
StreamMocket()
Create a new, unconnected, endpoint for a mocket connection. |
Method Summary | |
---|---|
void |
bind(java.net.SocketAddress localSocketAddress)
Binds a specific socket address (IP and port) to the local endpoint. |
void |
close()
Closes the connection. |
void |
connect(java.net.InetAddress remoteAddress,
int remotePort)
Opens a connection to the specified remote address and port. |
void |
connect(java.net.InetAddress remoteAddress,
int remotePort,
int connectTimeout)
Opens a connection to the specified remote address and port. |
protected void |
finalize()
Removes StreamMocket object. |
int |
getDataBufferingTime()
Returns the maximum time for buffering outgoing data before transmitting data. |
java.io.InputStream |
getInputStream()
Returns the input stream for this connection. |
java.net.SocketAddress |
getLocalSocketAddress()
Returns the local address as a socket address. |
java.io.OutputStream |
getOutputStream()
Returns the output stream for this connection. |
java.net.SocketAddress |
getRemoteSocketAddress()
Returns the address of the remote peer as a socket address. |
StreamMocket.Statistics |
getStatistics()
Returns the statistics associated with this mocket. |
boolean |
isConnected()
|
void |
setDataBufferingTime(int ms)
Sets the maximum time for buffering outgoing data before transmitting data. |
void |
setStatusListener(MocketStatusListener msl)
Register a callback function to be invoked when no data (or keepalive) has been received from the peer mocket. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StreamMocket() throws java.net.SocketException
java.net.SocketException
Method Detail |
---|
public void setStatusListener(MocketStatusListener msl)
msl
- callback function to register.public void connect(java.net.InetAddress remoteAddress, int remotePort) throws java.io.IOException
remoteAddress
- the remote address to connect to. Specified as an IP address.remotePort
- the remote port to connect to.
java.io.IOException
public void connect(java.net.InetAddress remoteAddress, int remotePort, int connectTimeout) throws java.io.IOException
remoteAddress
- the remote address to connect to. Specified as an IP address.remotePort
- the remote port to connect to.
java.io.IOException
- if there was a problem in opening the connectionpublic java.net.SocketAddress getLocalSocketAddress()
public java.net.SocketAddress getRemoteSocketAddress()
public void bind(java.net.SocketAddress localSocketAddress) throws java.io.IOException
localSocketAddress
- the socket address to which the local endpoint should be bound
java.io.IOException
- in case there is a problem with binding to the specified addresspublic StreamMocket.Statistics getStatistics()
Statistics
object for this mocket connection.public void setDataBufferingTime(int ms)
ms
- milliseconds data will wait in the buffer before transmission.public int getDataBufferingTime()
setDataBufferingTime(int)
public boolean isConnected()
protected void finalize()
StreamMocket
object.
finalize
in class java.lang.Object
public void close()
public java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |