use of com.jme3.network.kernel.KernelException in project jmonkeyengine by jMonkeyEngine.
the class NioEndpoint method close.
public void close(boolean flushData) {
if (flushData) {
closing = true;
// Enqueue a close marker message to let the server
// know we should close
send(CLOSE_MARKER, false, true);
return;
}
try {
// Note: even though we may be disconnected from the socket.isConnected()
// standpoint, it's still safest to tell the kernel so that it can be sure
// to stop managing us gracefully.
kernel.closeEndpoint(this);
} catch (IOException e) {
throw new KernelException("Error closing endpoint for socket:" + socket, e);
}
}
use of com.jme3.network.kernel.KernelException in project jmonkeyengine by jMonkeyEngine.
the class UdpEndpoint method send.
public void send(ByteBuffer data) {
if (!isConnected()) {
throw new KernelException("Endpoint is not connected:" + this);
}
try {
DatagramPacket p = new DatagramPacket(data.array(), data.position(), data.remaining(), address);
// Just queue it up for the kernel threads to write
// out
kernel.enqueueWrite(this, p);
//socket.send(p);
} catch (Exception e) {
if (e instanceof SocketException) {
throw new KernelException("Error sending datagram to:" + address, e);
} else if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(e);
}
}
}
use of com.jme3.network.kernel.KernelException in project jmonkeyengine by jMonkeyEngine.
the class UdpEndpoint method close.
public void close(boolean flush) {
try {
kernel.closeEndpoint(this);
connected = false;
} catch (IOException e) {
throw new KernelException("Error closing endpoint for socket:" + socket, e);
}
}
Aggregations