/* * 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"); } } }