Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Start ()
- {
- listenerThread = new Thread (new ThreadStart(DoListen));
- listenerThread.Start ();
- }
- void OnDestroy ()
- {
- listener.Stop ();
- listenerThread.Abort ();
- print ("abort");
- }
- // This subroutine is used a background listener thread to allow reading incoming
- // messages without lagging the user interface.
- private void DoListen ()
- {
- try {
- // Listen for new connections.
- listener = new TcpListener (System.Net.IPAddress.Any, Port);
- listener.Start ();
- do {
- //Debug.Log("Listen");
- } while(true);
- } catch (Exception ex) {
- Debug.Log (ex.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment