public void SendData(string host, byte[] requestPack, Socket resultContext) { RemoteClient client = null; try { var result = Dns.GetHostEntry(host); var address = result.AddressList[0]; lock (ConDic) { if (!ConDic.TryGetValue(address, out client)) { client = new RemoteClient(address); client.ConnectionClose += client_ConnectionClose; client.ConnectFail += client_ConnectFail; ConDic.Add(address, client); } } client.AddDataToQueue(requestPack, resultContext); } catch { } }
void RemoteClient_ConnectionClose(RemoteClient obj) { this.isConnect = false; this.evn.Set(); }
void RemoteClient_ConnectFail(RemoteClient arg1, Exception arg2) { this.isFailed = true; }