private void SendMessage(DataMessage msgToSend) { dataSend = new byte[2048]; try { dataSend = msgToSend.ToByte(); clientSocket.BeginSendTo(dataSend, 0, dataSend.Length, SocketFlags.None, serverEndPoint, new AsyncCallback(OnSend), null); } catch (Exception e) { MessageBox.Show(e.Message, "Client Sending", MessageBoxButtons.OK, MessageBoxIcon.Error); } }