| Method from com.sshtools.j2ssh.connection.SocketChannel Detail: |
public void bindSocket(Socket socket) throws IOException {
if (state.getValue() == ChannelState.CHANNEL_UNINITIALIZED) {
this.socket = socket;
} else {
throw new IOException(
"The socket can only be bound to an unitialized channel");
}
}
|
protected void onChannelClose() throws IOException {
try {
socket.close();
} catch (IOException ex) {
log.info("Failed to close socket on channel close event: " +
ex.getMessage());
}
}
|
protected void onChannelData(SshMsgChannelData msg) throws IOException {
try {
socket.getOutputStream().write(msg.getChannelData());
} catch (IOException ex) {
}
}
|
protected void onChannelEOF() throws IOException {
try {
//synchronized(state) {
//if (isOpen())
// close();
socket.shutdownOutput();
// }
} catch (IOException ex) {
log.info(
"Failed to shutdown Socket OutputStream in response to EOF event: " +
ex.getMessage());
}
}
|
protected void onChannelExtData(SshMsgChannelExtendedData msg) throws IOException {
// We do not have an extended data channel for the socket so ignore
}
|
protected void onChannelOpen() throws IOException {
if (socket == null) {
throw new IOException(
"The socket must be bound to the channel before opening");
}
thread = new Thread(new SocketReader());
thread.start();
}
|