/// <summary> /// Gets the <see cref="Socket"/> instance used by this client /// connection to send and receive data over the command channel. /// </summary> /// <returns>The socket instance used by the client to send and receive data over the command channel.</returns> public Socket GetCommandChannelSocket() { TcpServer tcpCommandChannel = m_commandChannel as TcpServer; TlsServer tlsCommandChannel = m_commandChannel as TlsServer; TransportProvider <Socket> tcpProvider; TransportProvider <TlsServer.TlsSocket> tlsProvider; if ((object)tcpCommandChannel != null && tcpCommandChannel.TryGetClient(m_clientID, out tcpProvider)) { return(tcpProvider.Provider); } if ((object)tlsCommandChannel != null && tlsCommandChannel.TryGetClient(m_clientID, out tlsProvider)) { return(tlsProvider.Provider.Socket); } return(null); }