示例#1
0
        private void SendButton_Click(object sender, EventArgs e)
        {
            TextMessage msg = new TextMessage(_message.Text);

            _sNetClient?.Send(msg.Buffer);
            _message.Text = "";
        }
示例#2
0
        private void SendMessage()
        {
            TextMessage msg = new TextMessage(String.Format("{0}: {1}", Nickname, Message.Text));

            switch (_role)
            {
            case "Server":
                LogMessage(msg.Text);
                _listenSocket.SendToAllClients(msg.Buffer);
                break;

            case "Client":
                _sNetClient?.Send(msg.Buffer);
                break;

            default:
                break;
            }
            Message.Text = "";
        }