Search code examples
gcdwebserver

Reuse the same port for GCDWebServer upon foregrounding?


When the app is suspended, is the server connection technically closed? When the user foregrounds the app again and the port has been set as 0, how likely is it that it will start with a different port? Just wondering what sort of cases to handle when my app has already passed a URL with a specific port to AVFoundation and then backgrounds and foregrounds the app


Solution

  • When you create a GCDWebServer instance, you specify a port, so that same port will always be used.

    If you pass 0, then a random one is used each time.