public override void ClientSend()
 {
     if (!string.IsNullOrWhiteSpace(ClientSendText))
     {
         _tcpClient.SendText(ClientSendText.Trim());
     }
 }
Beispiel #2
0
 public override void ClientSend()
 {
     if (!string.IsNullOrWhiteSpace(ClientSendText) && _shareMemClient.IsOpen)
     {
         _shareMemClient.SendText(ClientSendText.Trim());
     }
 }
        private void WebSocketPacketReceived(Packet packet)
        {
            lock (syncObject)
            {
                switch (packet.Action)
                {
                case WebSocketAction.Connect:
                    ClientConnected?.Invoke(packet.RemoteEndPoint, ((ConnectionPacket)packet).Cookies);
                    break;

                case WebSocketAction.SendText:
                    ClientSendText?.Invoke(packet.RemoteEndPoint, packet.Text);
                    break;

                case WebSocketAction.Disconnect:
                    var client = webSocketClients.FirstOrDefault(c => c.RemoteEndPoint.Equals(packet.RemoteEndPoint));
                    if (client != null)
                    {
                        client.Disconnect(4000, "Responding to client's request to close the connection.");
                        webSocketClients.Remove(client);
                        ClientDisconnected?.Invoke(packet.RemoteEndPoint, packet.Text);
                    }
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
        }
 public override void ClientSend()
 {
     if (!string.IsNullOrWhiteSpace(ClientSendText) && _pipeClient.Status == ClientStatus.Connected)
     {
         _pipeClient.SendText(ClientSendText.Trim());
     }
 }
 public override void ClientSend()
 {
     if (!string.IsNullOrWhiteSpace(ClientSendText) && _udpClient.IsRunning)
     {
         IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9001);
         _udpClient.SendText(ipEndPoint, ClientSendText.Trim());
     }
 }
 public void SendGroupMessage()
 {
     if (_useMulticast && _udpClient.IsRunning)
     {
         byte[] messageData = _udpClient.TextEncoding.GetBytes(ClientSendText.Trim());
         _udpClient.SendGroupMessage(messageData, 9001);
     }
 }