org.avineas.io.tcp
public class ServerSocketChannel extends java.lang.Object
| Constructor and Description |
|---|
ServerSocketChannel(int port)
Construct a server socket channel on a specific local port.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
read(byte[] data,
int offset,
long timeout)
Read a packet or byte array from the channel, filling up either the data buffer or
the information as present in the packet.
|
java.lang.String |
toString() |
int |
write(byte[] data,
int length)
Write a packet or number of bytes via the channel.
|
public ServerSocketChannel(int port)
throws java.io.IOException
port - The port to listen onjava.io.IOException - In case of errorspublic int read(byte[] data,
int offset,
long timeout)
ReadChannelread in interface ReadChanneldata - The byte buffer to read intooffset - The offset in the buffer to start readingtimeout - The timeout to wait for the first byte of data to become available, in ms.
If a value <= 0 is passed, no waiting is done at allpublic int write(byte[] data,
int length)
WriteChannelwrite in interface WriteChanneldata - The data to writelength - The length to write@PreDestroy public void close()
close in interface java.io.Closeablepublic java.lang.String toString()
toString in class java.lang.Object