Esempio n. 1
0
 public WorkInThread(Socket socket, int opCount, WorkItem item, string operation, Work work)
 {
     this.socket = socket;
     this.opCount = opCount;
     this.item = item;
     this.operation = operation;
     this.work = work;
 }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            Random rand = new Random();

            System.Console.SetWindowSize(80,50);

            Work work = new Work(rand);
            ServerHelper helper = new ServerHelper(work);
            helper.StartListener();
            int opCount = 0;
            string operation = "";
            do {
                operation = helper.WaitingForClient(opCount);
                opCount = Program.incrementOpCount(opCount);
            } while (!CommunicationHelper.OP_KILL.Equals(operation));
            System.Console.WriteLine("Kill Server by client..");
            helper.StopListener();
        }
Esempio n. 3
0
 public ServerHelper(Work work)
 {
     this.ipAddress = IPAddress.Parse(CommunicationHelper.HOST);
     this.listener = new TcpListener(this.ipAddress, CommunicationHelper.PORT);
     this.work = work;
 }