|
C#聊天程序(12) // Save the text for future comparison prevSendText = newText; } // Send a status notification private void SetStatus(Status status){ this.status = status; Notifications(Notification.StatusChange, status); } // Establish a socket connection and start receiving private void EstablishSocket(Object state){ try{ // If not client, setup listner if(!client){ Socket listener; try{ listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); listener.Blocking = true; listener.Bind(endPoint); SetStatus(Status.Listening);
|