private void _p2pPortClient_ConnectionLost(P2PPortClient client) { if (ConnectionWithRemoteComponentLostEvent != null) { ConnectionWithRemoteComponentLostEvent(this._remoteComponentName); } }
internal void DestroyLinkWithRemoteComponent(CNDAddressingReg addressingReg) { if (this._remoteComponentLinkTable.ContainsKey(addressingReg.ComponentName)) { P2PPortClient client = (P2PPortClient)this._remoteComponentLinkTable[addressingReg.ComponentName]; this._remoteComponentLinkTable.Remove(addressingReg.ComponentName); client.ConnectionLost -= P2PPortClient_ConnectionLost; client.Disconnect(); client.Dispose(); } }
internal void DestroyLinkWithRemoteComponent(string ComponentName) { if (this._remoteComponentLinkTable.ContainsKey(ComponentName)) { P2PPortClient client = (P2PPortClient)this._remoteComponentLinkTable[ComponentName]; this._remoteComponentLinkTable.Remove(ComponentName); client.ConnectionLost -= P2PPortClient_ConnectionLost; try { client.Dispose(); } catch (Exception) { } } }
public frmP2PPortClientMainform(string hostName, int port) { // This call is required by the Windows Form Designer. InitializeComponent(); // Add any initialization after the InitializeComponent() call. IPAddress addr; bool parsed = false; parsed = IPAddress.TryParse(hostName, out addr); if (parsed) { this._p2pPortclient = new P2PPortClient(hostName, addr.ToString(), port); } else { this._p2pPortclient = new P2PPortClient(hostName, port); } this._p2pPortclient.ConnectionLost += this.connectionLost; this._p2pPortclient.Connect(); this.Text = this.Text + " -> Connected to [" + hostName + ":" + System.Convert.ToString(port) + "]"; }