示例#1
0
        public void WaitForPackage()
        {
            while (true)
            {
                try
                {
                    SocketToForward.Receive(bufferForPacket);
                    Package package = Package.returnToPackage(bufferForPacket);
                    Console.WriteLine("[" + DateTime.UtcNow.ToString("HH:mm:ss.fff",
                                                                     CultureInfo.InvariantCulture) + "] " + "I received package at port: " + package.Port);
                    package.printInfo();

                    ForwardPacket(bufferForPacket);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
        }
示例#2
0
        public void WaitForPackage()
        {
            while (true)
            {
                try
                {
                    SocketToForward.Receive(bufferForPacket);
                    DataStream dataStream = DataStream.toData(bufferForPacket);
                    Console.WriteLine(this.Name + ": [" + DateTime.UtcNow.ToString("HH:mm:ss.fff",
                                                                                   CultureInfo.InvariantCulture) + "] " + "I received package at port: " + dataStream.currentPort);
                    // data.printInfo();

                    ForwardPacket(bufferForPacket);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }
        }