public void Abort() { if (this.socket != null) { if (this.socket.Connected) { this.socket.Disconnect(true); this.socket = null; } else { this.socket.Dispose(); this.socket = null; } } if (this.receivThread != null) { this.receivThread.Abort(); if (this.handleScript != null) { this.handleScript.Abort(); } this.handleScript = null; } }
public void Handle() { while (socket != null && socket.IsBound) { Socket executorSocket = socket.Accept(); this.mainformc.showmessage(executorSocket.RemoteEndPoint.ToString()); this.mainformc.changeIco(new System.Drawing.Bitmap(Properties.Resources.bot)); receivThread = new Thread(new ThreadStart((handleScript = new WireLessPC.ReceiveSender(executorSocket, this.mainformc)).receiveMessage)); receivThread.Start(); } }