private void ShuffaShutdown() { try { if (!serverKeyNull()) { sendMessageToServer(new Message("Disconnect", "Me")); } serverSocket.Close(); } catch { //we are closing } lock (voiceLock) { if (vc != null) { vc.endChat(); vc = null; } } try { axRDPViewer1.Disconnect(); } catch { //we are closing } socketThread.Abort(); cooldownThread.Abort(); //Console.WriteLine("Sharing Session Closed"); //Application.Exit(); }
/* * GoGoVoiceChat <peer ip addreess> <inPort> <outPort> * */ private void handleMessageGoGoVoiceChat(String data) { lock (voiceLock) { try { if (vc != null) { vc.endChat(); vc = null; } String[] tokens = data.Split(' '); if (tokens.Length == 3) { String otherEnd = tokens[0]; int inPort; int outPort; bool inSuc = int.TryParse(tokens[1], out inPort); bool outSuc = int.TryParse(tokens[2], out outPort); if (inSuc && outSuc) { vc = new VoiceChatlet(otherEnd, inPort, outPort); vc.startChat(); } else { // Console.WriteLine("unable to parse ports from data string: " + tokens[1] + " " + tokens[2]); } } else { // Console.WriteLine("invalid message format: " + data); //ignore message } } catch (SocketException e) { // Console.WriteLine("unable to open voice chat"); } } }
/** * closes the RDP Session and shuts down the application * also sends a "Disconnect" message to the server if connected * */ private void ShuffaShutdown() { try { rdpSession.Close(); } catch { //we are closing } try { sendMessageToServer(new Message("Disconnect", "Me")); serverSocket.Close(); } catch { //we are closing } lock (voiceLock) { try { vc.endChat(); vc = null; } catch { //we are closing } } socketThread.Abort(); cooldownThread.Abort(); //Console.WriteLine("Sharing Session Closed"); Application.Exit(); }