public class MultiplexerSocketController extends Object
Each client will have one SC on the client, and a matching SC on the server. A server will have a SC for each "real" client connection, all managed by MultiplexerServerSocketController.
Modifier and Type | Field and Description |
---|---|
static int |
STATUS_DisconnectedByError |
static int |
STATUS_DisconnetedByClient |
static int |
STATUS_DisconnetedByServer |
static int |
STATUS_Running
Status of real connection.
|
Modifier | Constructor and Description |
---|---|
|
MultiplexerSocketController(Socket socket)
Used by client to create a new multiplexed socket.
|
protected |
MultiplexerSocketController(Socket socket,
int id)
Created by MultiplexerServerSocketController for server-side connections.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
If the socket exists, then the other end of the socket will be notified to close, and then the socket will be closed.
|
protected void |
close(boolean bError) |
protected void |
closeSocket(VirtualSocket vs,
boolean bSendCommand) |
protected VirtualSocket |
createSocket(int connectionId,
int id,
String serverSocketName)
Used to create a new "virtual" socket.
|
VirtualSocket |
createSocket(String serverSocketName)
Creates a vsocket on client to communicated with a remote handler on server.
|
int |
getId() |
InetAddress |
getInetAddress() |
MultiplexerInputStreamController |
getInputStreamController() |
String |
getInvalidConnectionMessage() |
int |
getLiveSocketCount() |
VirtualSocket[] |
getMultiplexerSockets() |
MultiplexerOutputStreamController |
getOutputStreamController()
Used to control the real outputstream.
|
long |
getStartTimeMS() |
int |
getStatus() |
Thread |
getThread() |
boolean |
isClosed() |
boolean |
isValid()
Flag to know if socket is a valid socket connection.
|
protected void |
onSocketException(Exception e)
Called when there is a read on the "real" socket.
|
void |
setInvalidConnectionMessage(String msg)
Message to display when a non-multiplexersocket connects.
|
protected boolean |
verifyServerSideHandshake()
This will verify that the client that is connected is a valid MultiplexerSocket.
|
boolean |
wasCloseAlreadyCalled() |
public static final int STATUS_Running
public static final int STATUS_DisconnetedByClient
public static final int STATUS_DisconnetedByServer
public static final int STATUS_DisconnectedByError
public MultiplexerSocketController(Socket socket) throws Exception
Exception
protected MultiplexerSocketController(Socket socket, int id)
socket
- real connection to server.protected boolean verifyServerSideHandshake() throws IOException
IOException
public int getId()
public MultiplexerOutputStreamController getOutputStreamController()
public MultiplexerInputStreamController getInputStreamController()
public int getStatus()
public boolean isValid()
public long getStartTimeMS()
public Thread getThread()
public VirtualSocket createSocket(String serverSocketName) throws IOException
IOException
protected VirtualSocket createSocket(int connectionId, int id, String serverSocketName) throws IOException
IOException
protected void closeSocket(VirtualSocket vs, boolean bSendCommand) throws IOException
IOException
protected void onSocketException(Exception e)
public InetAddress getInetAddress()
public void close() throws IOException
IOException
public boolean wasCloseAlreadyCalled()
protected void close(boolean bError) throws IOException
IOException
public VirtualSocket[] getMultiplexerSockets()
public int getLiveSocketCount()
public boolean isClosed()
public void setInvalidConnectionMessage(String msg)
public String getInvalidConnectionMessage()
Copyright © 1999–2019 ViaOA. All rights reserved.