public Processor(int num,Listener listener) { ProcessorThread = new Thread(this.DoWork); _listener = listener; ProcessorNumber = num; _statisticDb = new ClientServerEntities(); }
public Main() { pChat = new PrivateChat(this); InitializeComponent(); listener = new Listener(2014); listener.SocketAccepted += listener_SocketAccepted; }
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); }
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)); } }
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); } }
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; }
/// <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; }
public void Start() { listener = new Listener (IPAddress.Loopback, 9999); }