Class SocketConnector
java.lang.Object
com.jme3.network.kernel.tcp.SocketConnector
- All Implemented Interfaces:
Connector
-
Constructor Summary
ConstructorsConstructorDescriptionSocketConnector(InetAddress address, int port) Creates a TCP connector to the specified remote address. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if there is currently data available for reading.protected voidEnsures the connector has not been closed.voidclose()Closes the connection.booleanReturns true if this connector is currently connected.read()Reads a chunk of data from the connection, blocking if there is no data available.voidwrite(ByteBuffer data) Writes a chunk of data to the connection from data.position() to data.limit().
-
Constructor Details
-
SocketConnector
Creates a TCP connector to the specified remote address.- Parameters:
address- the remote addressport- the remote port- Throws:
IOException- if the socket cannot be opened
-
-
Method Details
-
checkClosed
protected void checkClosed()Ensures the connector has not been closed. -
isConnected
public boolean isConnected()Description copied from interface:ConnectorReturns true if this connector is currently connected.- Specified by:
isConnectedin interfaceConnector- Returns:
- true if the connector is connected
-
close
-
available
public boolean available()Description copied from interface:ConnectorReturns true if there is currently data available for reading. Some connector implementations may not be able to answer this question accurately and will always return false. -
read
Description copied from interface:ConnectorReads a chunk of data from the connection, blocking if there is no data available. The buffer may only be valid until the next read() call is made. Callers should copy the data if they need it for longer than that. -
write
Description copied from interface:ConnectorWrites a chunk of data to the connection from data.position() to data.limit().
-