//connect with server using RTSP public void ListenForServer() { //Create a model to listen for server rtspModel = new RtspModel(int.Parse(view.ServerPort), this.ServerIP, ClientPort); UpdateClientBox("Client is waiting for server!" + Environment.NewLine); //blocks until the client has connected to the server rtspModel.ConnectWithServer(); UpdateClientBox("Client connected to server!" + Environment.NewLine); }
public void ListenForClients() { //Create a model to listen from clients rtspModel = new RtspModel(int.Parse(view.ServerPort), this.ServerIP); //Update the view UpdateServerIP(rtspModel.ServerIP.ToString()); while (true) { UpdateServerBox("Server is waiting for new connection #" + clientNum + Environment.NewLine); //blocks until a client has connected to the server var rtspSocket = rtspModel.AcceptOneClient(); clientNum++; //create a thread to handle communication with connected client clientThread = new Thread(new ParameterizedThreadStart(Communications)); clientThread.IsBackground = true; //to stop all threads with application is terminated clientThread.Start(rtspSocket); } }