private void FormOperator_Load(object sender, EventArgs e) { FormOperator o = new FormOperator(); Thread start = new Thread(o.ClientDealer); start.Start(); }
public void ClientHandler()//this function will be passed to the thread and handle the client request. { NetworkStream Stream; //FormOperator.sms("Test"); Stream = Client.GetStream(); //FormOperator.sms("Test2"); StreamReader reader = new StreamReader(Stream); StreamWriter writer = new StreamWriter(Stream); string recieved = reader.ReadLine(); FormOperator.sms(recieved);/////////////////////////// string[] splitted = new string[2]; splitted = recieved.Split(';'); string Operation = splitted[0]; string netString = splitted[1]; call = new BlockingLayer(); string[] result = call.FunctionCaller(Operation, netString); //FormOperator.sms(result[0]);////////////////////////////// writer.WriteLine(result[0]); //sending the result to the client as a string, because streamReader and writer //only sends and recieves Strings. writer.Flush(); Stream.Close(); Client.Close(); Thread.CurrentThread.Abort(); }