コード例 #1
0
ファイル: Processor.cs プロジェクト: KarpaDmytro/Labs
 public Processor(int num,Listener listener)
 {
     ProcessorThread = new Thread(this.DoWork);
     _listener = listener;
     ProcessorNumber = num;
     _statisticDb = new ClientServerEntities();
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: novakvova/lesson2
 public Main()
 {
     pChat = new PrivateChat(this);
     InitializeComponent();
     listener = new Listener(2014);
     listener.SocketAccepted += listener_SocketAccepted;
 }
コード例 #3
0
        public Server()
        {
            this._settings = new Settings();
            this._items = new Items();
            this.clients = new ClientList(ref this._settings, ref this._items);
            this._listener = new Listener(ref this._settings, ref this.clients);
            this.iu = new InterfaceUpdater(ref this._settings, ref this._listener, ref this.clients, ref _items);

            this._items.Bind(ref this.clients);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: KarpaDmytro/Labs
 static void Main(string[] args)
 {
     Worker worker = new Worker(6);
     Listener listener = new Listener();
     Console.WriteLine("Server is initialized,{0}\n==================",DateTime.Now);
     while (true)
     {
         string strData = listener.GetData();
         Console.WriteLine("Recived Request: {0},Time: {1}",strData,DateTime.Now);
         listener.CreateResponse(strData);
         worker.StartWork(Convert.ToInt32(strData));
     }
 }
コード例 #5
0
ファイル: Worker.cs プロジェクト: KarpaDmytro/Labs
        public Worker(int procCount,Listener listener)
        {
            Listener = listener;
            procesorsList = new List<Processor>();
            QueueThread = new Thread(QueueManager);
            QueueThread.Start();

            for (int i = 1; i <= procCount; i++)
            {
                var proc = new Processor(i,listener);
                procesorsList.Add(proc);
            }
        }
コード例 #6
0
        public InterfaceUpdater(ref Settings _settings, ref Listener _listener, ref ClientList clients, ref Items auctionItems)
        {
            this.runnig = false;
            this.updateing = false;

            this._settings = _settings;
            this._listener = _listener;
            this.clients = clients;
            this.auctionItems = auctionItems;

            this.task = new Thread(new ThreadStart(Task));
            this.task.Name = THREAD_NAME;

            Console.Title = CONSOLE_TITLE + " - " + this._settings.ServerIP;
        }
コード例 #7
0
ファイル: Server.cs プロジェクト: brgj/Wizards-or-whatever
        /// <summary>
        /// Create a new Server object
        /// </summary>
        /// <param name="port">The port you want to use</param>
        public Server(int port)
        {
            //Initialize the array with a maximum of the MaxClients from the config file.
            client = new Client[Properties.Settings.Default.MaxNumberOfClients];

            //Create a new Listener object
            listener = new Listener(port);
            listener.userAdded += new ConnectionEvent(listener_userAdded);
            listener.Start();

            //Create the readers and writers.
            readStream = new MemoryStream();
            writeStream = new MemoryStream();
            reader = new BinaryReader(readStream);
            writer = new BinaryWriter(writeStream);

            //Set the singleton to the current object
            Server.singleton = this;
        }
コード例 #8
0
 public void Start()
 {
     listener = new Listener (IPAddress.Loopback, 9999);
 }