public class MultiplexerClient extends Object
An Client can then have a single connection to a server and then have multiple virtual socket connections through this connection.
to create the connection to the server.
Constructor and Description |
---|
MultiplexerClient(String host,
int port)
Create a new client.
|
MultiplexerClient(URI uri)
Create a new client.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the "real" socket to server.
|
VirtualSocket |
createSocket(String serverSocketName)
Create a socket to a VServerSocket.
|
int |
getConnectionId()
The connectionId that has been assigned by the server.
|
int |
getCreatedSocketCount() |
String |
getHost()
Server host name or ip address for the Server.
|
int |
getKeepAlive() |
int |
getLiveSocketCount() |
int |
getPort()
Port used for connecting to the server.
|
long |
getReadCount() |
long |
getReadSize() |
Socket |
getSocket()
Get the "real" socket.
|
int |
getThrottleLimit() |
long |
getWriteCount() |
long |
getWriteSize() |
boolean |
isConnected()
Returns true if real socket is connected to server.
|
protected void |
onClose(boolean bError) |
protected void |
onSocketException(Exception e)
Called when there is a socket exception
|
void |
pingServer() |
void |
runKeepAliveThread() |
void |
setKeepAlive(int seconds) |
void |
setThrottleLimit(int mbPerSecond)
Used to set the limit on the number of bytes that can be written per second (in MB).
|
void |
start()
Used to create the connection to the MultiplexerServer.
|
public MultiplexerClient(URI uri) throws Exception
uri
- URI, that includes host and portException
MultiplexerClient(String, int)
public MultiplexerClient(String host, int port)
host
- ip or name of server to connect to.port
- port number of the server to connect to.public void start() throws Exception
Exception
protected void onSocketException(Exception e)
protected void onClose(boolean bError)
public void setKeepAlive(int seconds)
public int getKeepAlive()
public void runKeepAliveThread()
public void setThrottleLimit(int mbPerSecond)
public int getThrottleLimit()
public VirtualSocket createSocket(String serverSocketName) throws IOException
serverSocketName
- the name given to the socket when creating in MultiplexerServer.IOException
public int getCreatedSocketCount()
public int getLiveSocketCount()
public void close() throws IOException
IOException
public int getConnectionId()
public boolean isConnected()
public Socket getSocket()
public int getPort()
public String getHost()
public long getWriteCount()
public long getWriteSize()
public long getReadCount()
public long getReadSize()
Copyright © 1999–2019 ViaOA. All rights reserved.