Example #1
0
        public override void ExecuteCommand(CommonBinarySession session, CommonRequestInfo pack)
        {
            CommonAppServer server = session.AppServer as CommonAppServer;

            if (server != null)
            {
                server.PrintMsg($"({session.RemoteEndPoint}):{Encoding.UTF8.GetString(pack.Body)}");
            }
        }
Example #2
0
        public override void ExecuteCommand(CommonBinarySession session, CommonRequestInfo pack)
        {
            CommonAppServer server = session.AppServer as CommonAppServer;

            if (server != null)
            {
                //var mAll = server.GetAllSessions();
                //if (mAll.Any())
                //{

                //    mAll.All(mClient =>
                //    {
                //        string mClientAddr = mClient.RemoteEndPoint.ToString();
                //        string mRemoteAddr = session.RemoteEndPoint.ToString();
                //        if (mClient.Connected &&!mClientAddr.Equals(mRemoteAddr))
                //        {
                //            var senddata = pack.Body.ToSendData(CommonCommands.Voice);
                //            mClient.Send(senddata);

                //        }
                //        return true;
                //    });
                //}
                if (server != null)
                {
                    server.GetSessions(i => i.SessionID != session.SessionID).All(mClient =>
                    {
                        Task.Run(() =>
                        {
                            var senddata = pack.Body.ToSendData(CommonCommands.Voice);
                            mClient.Send(senddata);
                        });
                        return(true);

                        ;
                    });
                }

                //publicVar.wBufferProvider.AddSamples(pack.Body,0,pack.Body.Length);
                //publicVar.mOutStream.Play();
            }
            //Console.WriteLine(pack.Name + ":" + pack.Other);
        }