コード例 #1
0
 public void SendCommandFromAllClients(MessageDescript descript)
 {
     foreach (var client in Clients)
     {
         sendner.asynSendMessageFromClient(descript, client.Value, allocSendedMessageFromClient, allocDropClientSendMessage);
     }
 }
コード例 #2
0
 public InfoSendRecvest(MessageDescript descript,
                        ClientInfo client,
                        Action <ClientInfo, MessageDescript> allocToSendedMessage,
                        Action <ClientInfo, Exception> allocToDropSendClient)
 {
     Descript              = descript;
     Client                = client;
     AllocToSendedMessage  = allocToSendedMessage;
     AllocToDropSendClient = allocToDropSendClient;
 }
コード例 #3
0
        private void DoTemplate(NetServer server, NetClient client, MessageDescript descript)
        {
            if (client != null)
            {
                OnGetCommandClientLogic(client, descript.Message);
            }

            if (server != null)
            {
                OnGetCommandServerLogic(server, descript.Message);
            }
        }
コード例 #4
0
 public void GetCommandTemplate(NetServer server, NetClient client, MessageDescript descript)
 {
     if (isWorkInMainThread)
     {
         var info = new InfoMethodLoop(server, client, descript, DoTemplate);
         TNFManager.Iterator.AddTask(info);
     }
     else
     {
         DoTemplate(server, client, descript);
     }
 }
コード例 #5
0
        public void asynSendMessageFromClient(MessageDescript descript, ClientInfo client, Action <ClientInfo, MessageDescript> allocToSendedMessage, Action <ClientInfo, Exception> allocToDropSendClient)
        {
            InfoSendRecvest info = new InfoSendRecvest(descript, client, allocToSendedMessage, allocToDropSendClient);


            sendRecvests.Enqueue(info);

            if (sendingNow)
            {
                return;
            }

            sendingNow = true;
            StartProtectedThread(SendingQueue);
        }
コード例 #6
0
        private void SendMessage(MessageDescript descript, ClientInfo client, Action <ClientInfo, MessageDescript> allocToSendedMessage, Action <ClientInfo, Exception> allocToDropSendClient)
        {
            lock (locker)
            {
                try
                {
                    var stream = client.ClientTCP.GetStream();

                    stream.Write(descript.Buffer, 0, descript.Buffer.Length);

                    allocToSendedMessage(client, descript);
                }
                catch (Exception e)
                {
                    lock (locker)
                    {
                        allocToDropSendClient(client, e);
                    }
                }
            }
        }
コード例 #7
0
 private void allocSendedMessageFromClient(ClientInfo client, MessageDescript descript)
 {
 }
コード例 #8
0
 private void allocSended(ClientInfo info, MessageDescript descript)
 {
     DebugAdapter.Log($"Sended: {descript.Message}");
 }