/** * Sends a binding request to the specified server address with only change * port flag set to true and change IP flag - to false. * @param serverAddress the address where to send the bindingRequest. * @return The returned message encapsulating event or null if no message * was received. * @throws StunException if an exception occurs while sending the messge */ private StunMessageEvent doTestIII(StunAddress serverAddress) { Request request = MessageFactory.CreateBindingRequest(); ChangeRequestAttribute changeRequest = (ChangeRequestAttribute)request.GetAttribute(Attribute.CHANGE_REQUEST); changeRequest.SetChangeIpFlag(false); changeRequest.SetChangePortFlag(true); StunMessageEvent evt = requestSender.SendRequestAndWaitForResponse(request, serverAddress); #if false if (evt != null) { System.oout.println("Test III res=" + evt.getRemoteAddress().toString() + " - " + evt.getRemoteAddress().getHostName()); } else { Console.WriteLine("NO RESPONSE received to Test III."); } #endif return(evt); }
CreateChangeRequestAttribute(bool changeIP, bool changePort) { ChangeRequestAttribute attribute = new ChangeRequestAttribute(); attribute.SetChangeIpFlag(changeIP); attribute.SetChangePortFlag(changePort); return(attribute); }
/** * Creates a ChangeRequestAttribute with the specified flag values. * @param changeIP the value of the changeIP flag. * @param changePort the value of the changePort flag. * @return the newly created ChangeRequestAttribute. */ public static ChangeRequestAttribute CreateChangeRequestAttribute(bool changeIP, bool changePort) { ChangeRequestAttribute attribute = new ChangeRequestAttribute(); attribute.SetChangeIpFlag(changeIP); attribute.SetChangePortFlag(changePort); return attribute; }