openTcpChannel method
Channel
openTcpChannel(
- String sourceHost,
- int sourcePort,
- String destHost,
- int destPort,
- ChannelCallback cb, {
- VoidCallback connected,
- StringCallback error,
Request remote opens a new TCP channel to destHost
:destPort
.
Implementation
Channel openTcpChannel(String sourceHost, int sourcePort, String destHost,
int destPort, ChannelCallback cb,
{VoidCallback connected, StringCallback error}) {
if (socket == null || state <= SSHTransportState.FIRST_NEWKEYS) return null;
if (debugPrint != null) debugPrint('openTcpChannel to $destHost:$destPort');
Channel chan = channels[nextChannelId] = Channel(
localId: nextChannelId++,
windowS: initialWindowSize,
cb: cb,
error: error,
connected: connected);
nextChannelId++;
writeCipher(MSG_CHANNEL_OPEN_TCPIP(
'direct-tcpip',
chan.localId,
chan.windowS,
maxPacketSize,
destHost,
destPort,
sourceHost,
sourcePort));
return chan;
}