Example #1
0
        public static void Main(string[] args)
        {
            int port = 8000;

            if (args.Length > 0)
            {
                port = int.Parse(args[0], CultureInfo.InvariantCulture);
            }
            string csvFile = null;

            if (args.Length > 1)
            {
                csvFile = args[1];
            }

            Console.WriteLine($"Listening on port {port}");
            if (!string.IsNullOrEmpty(csvFile))
            {
                Console.WriteLine($"Writing output to \"{csvFile}\"");
            }
            GemServer gemServer = new GemServer(IPAddress.Any, port, csvFile);

            gemServer.Start();

            Console.WriteLine("Press Enter to stop...");
            Console.ReadLine();

            gemServer.Stop();
            gemServer.Dispose();
        }
Example #2
0
 public GemSession(GemServer server)
 {
     Server                      = server;
     ReceiveEventArgs            = new SocketAsyncEventArgs();
     ReceiveEventArgs.Completed += OnAsyncCompleted;
     Id     = Guid.NewGuid();
     Packet = new Bin48NetTime();
     ReceiveEventArgs.SetBuffer(new byte[BufferSize]);
     Lock = new object();
 }