private int[] intProposedCompressedSize = new int[5]; // An array to hold the compressed size of message for each proposal. public ProtocolB2(ProtocolInitial Parent, ref TChannelProperties stcNewChannel, ref ArrayList aryMessages) { // // Initialize the keepalive timer used during long file downloads to keep the remote TCP link from timing out // // tmrKeepAlive = New Timer // AddHandler tmrKeepAlive.Elapsed, AddressOf OnKeepAliveTimer // tmrKeepAlive.AutoReset = False // tmrKeepAlive.Interval = 120000 ' 2 minutes // Instantiates a B2 channel protocol handler... stcChannel = stcNewChannel; objInitialProtocol = Parent; StateChange(EB2States.WaitingForNewCommand); Globals.blnFQSeen = false; if (!string.IsNullOrEmpty(stcChannel.RemoteCallsign)) { var strTokens = stcChannel.RemoteCallsign.Split('-'); strBaseConnectedCall = strTokens[0]; } aryOutboundMessages = aryMessages; B2OutboundProposal(); } // New
public void Poll() { if (Globals.blnChannelActive == false) { return; } if (enmState != LinkStates.Connected) { intTimeout += 1; if (intTimeout > 100) // Approx 10 seconds worth of timer ticks... { intTimeout = 0; if (Globals.UseRMSRelay()) { Globals.queChannelDisplay.Enqueue("R*** No connection to RMS Relay at " + DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm UTC")); } else { Globals.queChannelDisplay.Enqueue("R*** No connection to WL2K CMS Telnet at " + DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm UTC")); } enmState = LinkStates.LinkFailed; cancelTokenSource.Cancel(); // cancels any pending reads objTCPPort.Close(); } } while (queDataBytesIn.Count > 0) { byte[] bytIn; try { bytIn = (byte[])queDataBytesIn.Dequeue(); } catch { break; } if (enmState == LinkStates.Connected) { objProtocol.ChannelInput(ref bytIn); } else { SignInLine(Globals.GetString(bytIn)); } } if (enmState == LinkStates.LinkFailed) { if (objTCPPort is object) { if (objTCPPort.Connected) { Disconnect(); } } else { try { if (objProtocol != null) { objProtocol.LinkStateChange(ConnectionOrigin.Disconnected); objProtocol = null; } } catch (Exception ex) { Log.Error("[ModemTelnet.Poll] " + ex.Message); } } } } // Poll