Ejemplo n.º 1
0
 void client_ReceiveMessageEvent(SocketServerLib.SocketHandler.AbstractTcpSocketClientHandler handler, SocketServerLib.Message.AbstractMessage message)
 {
     BasicMessage receivedMessage = (BasicMessage)message;
     byte[] buffer = receivedMessage.GetBuffer();
     string s = System.Text.ASCIIEncoding.Unicode.GetString(buffer);
     this.SetReceivedText(s);
 }
Ejemplo n.º 2
0
 private void server_ReceiveMessageEvent(SocketServerLib.SocketHandler.AbstractTcpSocketClientHandler handler, SocketServerLib.Message.AbstractMessage message)
 {
     BasicMessage receivedMessage = (BasicMessage)message;
     byte[] buffer = receivedMessage.GetBuffer();
     if (buffer.Length > 1000)
     {
         MessageBox.Show(string.Format("Received a long message of {0} bytes", receivedMessage.MessageLength), "Socket Server",
             MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     string s = System.Text.ASCIIEncoding.Unicode.GetString(buffer);
     this.SetReceivedText("Client " + message.ClientUID + ": " + s);
 }
Ejemplo n.º 3
0
 void client_ConnectionEvent(SocketServerLib.SocketHandler.AbstractTcpSocketClientHandler handler)
 {
     MessageBox.Show(string.Format("Client connected to remote server."), "Socket Client", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }