Exemplo n.º 1
0
 //Message received
 void mainServer_MessageReceived(TCPSocketServer socketServer, SocketMessageReceivedArgs e)
 {
     if (this.txtServerLog.InvokeRequired)
     {
         this.txtServerLog.Invoke(new ServerLogCallBack(this.serverLog), new object[] { "Mensagem retornada:\n" + e.MessageContent + "\n" });
     }
     else
     {
         txtServerLog.AppendText(e.MessageContent);
     }
 }
Exemplo n.º 2
0
        //Primary Server Controller Actions
        private void ClienteConectado(TCPSocketServer server, SocketConnectArgs e)
        {
            if (this.lstConectados.InvokeRequired)
            {
                // It's on a different thread, so use Invoke
                //envia uma mensagem de boas vindas ao cliente
                server.SendMessage("Welcome to xprotector Sockets server\nWaiting credentials.", e.clientID);

                this.Invoke(new AddClientCallback(this.AddClient), new object[] { e.clientID + ":" + e.ConnectedIP.ToString() });
            }
            else
            {
                lstConectados.Items.Add("Cliente conectado: " + e.ConnectedIP.ToString());
            }
        }