private void Send() { if (Sending == false) { if (msg.Count() > 0) { Sending = true; Msg m = msg.Dequeue(); if (m != null) { byte[] buf = m.Serialize_Msg(); if (socket.CheckConnect()) { socket.SendAsync(buf, (ok) => { if (ok) { Sending = false; } }); } else { msg.Enqueue(m); } } } } }//end send
public void Send() { if (msg.Count() > 0) { Msg m = msg.Dequeue(); if (m != null) { byte[] buf = m.Serialize_Msg(); socket.Send(buf); Thread.Sleep(10); } } }