private void cmdSendData_Click(object sender, EventArgs e) { try { m_terminal.SendMessage(txtData.Text); } catch (SocketException se) { MessageBox.Show(se.Message); } }
private void cmdSendMessage_Click(object sender, EventArgs e) { try { string mes = txtData.Text; byte[] buffer = ConvertStrToBytes(mes); m_ClientTerminal.SendMessage(buffer); } catch (SocketException se) { MessageBox.Show(se.Message); } }
private void cmdSendMessage_Click(object sender, EventArgs e) { try { string mes = txtData.Text; // Create the concrete message SendingTimeMessage message = new SendingTimeMessage(mes); int messageKind = (int)MessageKind.SendingTime; byte[] buffer = MessageComposer.Serialize(messageKind, message); // Send the message (as bytes) to the server. m_ClientTerminal.SendMessage(buffer); } catch (SocketException se) { MessageBox.Show(se.Message); } }