iOS4: UDP sockets in the background

  • Hello,

    Can the new iOS 4 maintain UDP socket connection in the background? Or is it only TCP?

    Thanks in advance!

    Regards,
    Angie
  • On Jun 22, 2010, at 10:28 PM, Angelica Grace Tanchico wrote:

    >
    > Hello,
    >
    > Can the new iOS 4 maintain UDP socket connection in the background? Or is it only TCP?

    I have been doing that without a problem since early iOS 3, so no reason to expect it would stop working in iOS4.

    Gerd
  • On 23 Jun 2010, at 1:15 PM, Gerd Knops wrote:

    > On Jun 22, 2010, at 10:28 PM, Angelica Grace Tanchico wrote:
    ...
    >
    >> Can the new iOS 4 maintain UDP socket connection in the background? Or is it only TCP?
    >
    > I have been doing that without a problem since early iOS 3, so no reason to expect it would stop working in iOS4.

    You've been networking in a background application since iOS 3?

    — F
  • On Jun 23, 2010, at 2:05 PM, Fritz Anderson wrote:

    >
    > On 23 Jun 2010, at 1:15 PM, Gerd Knops wrote:
    >
    >> On Jun 22, 2010, at 10:28 PM, Angelica Grace Tanchico wrote:
    > ...
    >>
    >>> Can the new iOS 4 maintain UDP socket connection in the background? Or is it only TCP?
    >>
    >> I have been doing that without a problem since early iOS 3, so no reason to expect it would stop working in iOS4.
    >
    > You've been networking in a background application since iOS 3?
    >
    Sorry, I misunderstood the question. No, not in a background application, rather in a background thread of the active application. Apologies all around.

    Gerd
  • On 23.6.2010, at 20:15, Gerd Knops wrote:

    > I have been doing that without a problem since early iOS 3, so no reason to expect it would stop working in iOS4.

    FYI, doc quote ...

    Cancel any Bonjour-related services before being suspended. When your application moves to the background, and before it is suspended, it should unregister from Bonjour and close listening sockets associated with any network services. A suspended application cannot respond to incoming service requests anyway. Closing out those services prevents them from appearing to be available when they actually are not. If you do not close out Bonjour services yourself, the system closes out those services automatically when your application is suspended.

    Be prepared to handle connection failures in your network-based sockets. The system may tear down socket connections while your application is suspended for any number of reasons. As long as your socket-based code is prepared for other types of network failures, such as a lost signal or network transition, this should not lead to any unusual problems. When your application resumes, if it encounters a failure upon using a socket, simply reestablish the connection.
  • Hi Robert,

    Thanks for emphasizing this, but I am really confused. I have a VOIP app. How can I still have network connection in the background when my app uses network-socket connection?

    Also according to document:
    In order for your application to maintain a persistent connection
    while it is in the background, you must configure the sockets used to
    communicate with your VoIP service. In iPhone OS, most sockets are
    managed using higher-level constructs such as streams. As a result,
    configuration of a socket to support VoIP occurs through the
    higher-level interfaces. The only thing you have to do beyond the
    normal configuration is add a special key that tags the interface as
    being used for a VoIP service.

    But how can iOS4 support voip when the app uses bsd sockets (not the high level socket interface)?
    Is there any way where I don't need to change my network implementation to high level sockets?

    Thanks!
    Angie

    > Subject: Re: iOS4: UDP sockets in the background
    > From: <robert...>
    > Date: Fri, 25 Jun 2010 00:19:04 +0200
    > CC: <atanchico...>; <cocoa-dev...>
    > To: <gerti-cocoadev...>
    >
    >
    > On 23.6.2010, at 20:15, Gerd Knops wrote:
    >
    >> I have been doing that without a problem since early iOS 3, so no reason to expect it would stop working in iOS4.
    >
    >
    > FYI, doc quote ...
    >
    > Cancel any Bonjour-related services before being suspended. When your application moves to the background, and before it is suspended, it should unregister from Bonjour and close listening sockets associated with any network services. A suspended application cannot respond to incoming service requests anyway. Closing out those services prevents them from appearing to be available when they actually are not. If you do not close out Bonjour services yourself, the system closes out those services automatically when your application is suspended.
    >
    > Be prepared to handle connection failures in your network-based sockets. The system may tear down socket connections while your application is suspended for any number of reasons. As long as your socket-based code is prepared for other types of network failures, such as a lost signal or network transition, this should not lead to any unusual problems. When your application resumes, if it encounters a failure upon using a socket, simply reestablish the connection.

    _________________________________________________________________
    Hotmail: Trusted email with powerful SPAM protection.
    On Thu, Jun 24, 2010 at 10:10 PM, Angelica Grace Tanchico
    <atanchico...> wrote:
    > Also according to document:
    > In order for your application to maintain a persistent connection
    > while it is in the background, you must configure the sockets used to
    > communicate with your VoIP service. In iPhone OS, most sockets are
    > managed using higher-level constructs such as streams. As a result,
    > configuration of a socket to support VoIP occurs through the
    > higher-level interfaces. The only thing you have to do beyond the
    > normal configuration is add a special key that tags the interface as
    > being used for a VoIP service.
    >
    > But how can iOS4 support voip when the app uses bsd sockets (not the high level socket interface)?
    > Is there any way where I don't need to change my network implementation to high level sockets?

    The documentation Robert quoted seems to imply that multitasking
    doesn't result in your sockets behaving any differently than they
    might under other normal circumstances. Which means that you should be
    perfectly okay with using BSD sockets. The documentation you've quoted
    seems to me to simply state that the higher-level networking
    constructs properly handle socket errors, which means they correctly
    deal with app backgrounding.

    Have you tried using BSD sockets and gotten any bad results? There's
    no point going around and around in circles without actually trying
    the code.

    --Kyle Sluder
previous month june 2010 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Go to today