private static MessageStructure DoRequest(IPEndPoint remoteEndPoint, string param, int bufferSize) { byte[] data = Encoding.UTF8.GetBytes("?d=" + param); MessageStructure ms = null; var client = new ClientSocket(new ClientSocketSettings(1024, remoteEndPoint)); using (var singal = new ManualResetEvent(false)) { client.DataReceived += (sender, e) => { ms = new MessageStructure(e.Data); singal.Set(); }; client.Connect(); client.PostSend(data, 0, data.Length); singal.WaitOne(10000);//10s client.Close(); } return ms; }