private void btnSend_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(tbPayLoad.Text)) { return; } try { tbConsole.Text = DateTime.Now.ToString("h:mm:ss tt") + " Client: " + tbPayLoad.Text + "\n" + tbConsole.Text; client.Send(tbPayLoad.Text); tbPayLoad.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void Send(byte[] data) { byte[] pSendData = this.StructurePack(data); m_Client.Send(pSendData); }