Re: [reSIProcate] Stun Delay Problem
Gurpreet,
you can't speed up the time the STUN test takes, so you need
to send the test a while before you need the result.
So the alternative would be to send a STUN request every n minutes
(e.g. 3min) through a timer, then you would only need to check
if there is a valid result.
Best regards,
Matthias Moetje
______________________________________________
TERASENS GmbH Phone: +49.89.143370-0
Augustenstraße 24 Fax: +49.89.143370-22
80333 Munich e-mail: info@xxxxxxxxxxxx
GERMANY Web: www.terasens.com
______________________________________________
> -----Original Message-----
> From: resiprocate-devel-bounces@xxxxxxxxxxxxxxx [mailto:resiprocate-devel-
> bounces@xxxxxxxxxxxxxxx] On Behalf Of Gurpreet Sidhu
> Sent: Dienstag, 10. März 2009 15:36
> To: resiprocate-devel@xxxxxxxxxxxxxxx
> Subject: [reSIProcate] Stun Delay Problem
>
>
> Hi everyone
>
> this is my code for getting stun address
>
> resip::Tuple Util::GetStunAddres(resip::UdpTransport *udp_p)
> {
> DebugLog(<<"Crossbow::Entered into GetStunAddress");
> resip::Tuple mMappedAddress;
> mMappedAddress.setPort(0);
> string IpAddress="";
> if (!udp_p) return mMappedAddress;
> if (!udp_p->stunResult(mMappedAddress))
> {
> // no valid result available, send another request
> SendStunTest(udp_p);
> }
>
> else if ((GetTickCount() - mLastStunTestTime) > 1000 * 60 * 3)
> {
> // don't use a STUN response that is older than 3 minutes
> SendStunTest(udp_p);
> }
>
> DWORD dwTmpLastStunTestTime = mLastStunTestTime;
>
> while ((GetTickCount() - dwTmpLastStunTestTime) < 5 * 1000)
> {
> Sleep(12000);
> if (udp_p->stunResult(mMappedAddress))
> IpAddress=resip::Tuple::inet_ntop(mMappedAddress).c_str();
> DebugLog(<<"Crossbow::Stun Mapped Address is "<<IpAddress);
> break;
> Sleep(15000);
> }
>
> IpAddress=resip::Tuple::inet_ntop(mMappedAddress).c_str();
> DebugLog(<<"Crossbow::Stun Mapped Address is "<<IpAddress);
> return mMappedAddress;
>
> }
>
> This code works fine.But if i put first Sleep as Sleep(100) and second
> Sleep as Sleep(200) in While Loop then my Ipaddress string contains 0.0.0.0
> although request goes to STUN Server . I want to minimize this delay.
> So What is the most appropriate way to minimize this delay and get a mapped
> address correctly?
> Thanks in Advance
> Gurpreet Singh Sidhu
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxx
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel