×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jun 2007
    Location
    INDIA
    Posts
    73

    Socket Sendto is taking too much time when Wifi is down

    Hi,

    I have connected to WiFi using RConnection and passing the same instance to RSocket::Open.

    I am using multiple threads and WiFi connection management is done in main thread and socket operations are done in another thread.

    Every thing is fine, except when WiFi goes completely down. When down, Sendto (UDP) is taking from 600ms to 5 sec to comeout. Ofcourse with error -3.
    I am calling User::WaitForRequest() immediately after calling Sendto.[I desperately do this, since I'm porting, I should not change the Framework behaviour]

    How to prevent this scenario. My thread blocks on Sendto.

    Thanks for your time and help.

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    30

    Re: Socket Sendto is taking too much time when Wifi is down

    Argh!

    Porting is not an excuse for sloppy coding! You should not use blocking APIs. Period. Ironically you yourself point out that you're thread blocks on SendTo...

    I'm surprised that you are suffering from SendTo blocking for that long a period since there's no retry mechanism for UDP packets and if the flow is down, the packets should just be discarded, in device.

    One solution could be to use a timer to wait for SendTo to complete, before cancelling the request, but I don't personally recommend it, because the amount of variation in the type of bearer present on a mobile device.


    Quote Originally Posted by bytes View Post
    Hi,

    I have connected to WiFi using RConnection and passing the same instance to RSocket::Open.

    I am using multiple threads and WiFi connection management is done in main thread and socket operations are done in another thread.

    Every thing is fine, except when WiFi goes completely down. When down, Sendto (UDP) is taking from 600ms to 5 sec to comeout. Ofcourse with error -3.
    I am calling User::WaitForRequest() immediately after calling Sendto.[I desperately do this, since I'm porting, I should not change the Framework behaviour]

    How to prevent this scenario. My thread blocks on Sendto.

    Thanks for your time and help.

  3. #3
    Regular Contributor
    Join Date
    Jun 2007
    Location
    INDIA
    Posts
    73

    Re: Socket Sendto is taking too much time when Wifi is down

    Hi Max,

    Thanks for your reply.

    So the best coding is, use Sockes in asynchoronous way and as soon I detect WiFi down, cancel the request. I hope I'm on right track.

    Is there no other way ???

    One of my intentions for the post, is I need the reason for this behaviour.

    Any of the forum members facing the same problem ???

    cheer
    Bytes

Similar Threads

  1. S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket?
    By www_peach in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-02-01, 02:57
  2. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  3. Replies: 0
    Last Post: 2005-09-20, 03:58
  4. Shutting down a socket connection - How to ?
    By prsens in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2003-06-01, 07:44
  5. SMS time stamp format with time zone parameter?
    By turunhe in forum General Messaging
    Replies: 1
    Last Post: 2002-06-11, 07:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×