0

I use GCDWebServer, precisely WebUploader. When I test it on the iPhone Simulator then everything works, but on the device I cannot see web page when I enter e.g. http://192.168.2.4:8080 to the browser. I got Connection timed out from the browser.

I am connected with the WiFi to the same network, I don't see any errors in the console, so what can be wrong? I use iOS 8.

Bartosz Bialecki
  • 4,391
  • 10
  • 42
  • 64

3 Answers3

1

Are you sure you are using the correct port? When running on an iOS device, the default port is 80, not 8080.

Check the log in Xcode when the app is running, it will tell exactly what the IP address and port for GCDWebServer.

The fact that you are getting a time out connection however instead of a not found error could mean that something else is preventing the connection from opening. Make sure the app is the active one on your iOS device, otherwise the server might be suspended.

Also try restarting your iOS device, there's a rare bug in iOS where a listening socket previously used by an app can remain "stuck" for a few minutes even if the app has been killed.

If this still doesn't work, then it's more than likely a WiFi router problem where traffic is blocked between your computer and your iOS device.

Pol
  • 3,848
  • 1
  • 38
  • 55
  • Yes, on device I have port 80, app is active. I tried also start web server on custom port, but it does not work either. – Bartosz Bialecki Aug 07 '15 at 08:25
  • Then it really sounds like a WiFi router problem: try on a different WiFi network and / or try to connect to GCDWebServer running on your computer from another computer (or even your iOS device). – Pol Aug 07 '15 at 14:23
  • You're right, it must be something wrong with network. I checked on the other network and it works. Thank you. – Bartosz Bialecki Aug 07 '15 at 19:57
1

GCDWebServer doesn't work if connected with different wifi network. it only works if both mobile and pc uses same wifi network. what i have to do if i want GCDWebServer work even with different wifi network. @Pol

sKhan
  • 9,694
  • 16
  • 55
  • 53
Kevin Mac
  • 320
  • 2
  • 10
0

GCDWebServer is a very light and trusting Web Server. I've been releasing WebDAV music streamer which capable of creating playlist dynamically. While creating a playlist, it sends a lot of asynchronous NSURLSessions. There was no need to modify original source code except for the value of GCDWebServerOption_MaxPendingConnections. I think GCDWebServerOption_MaxPendingConnections=16 seems to be small for asynchronous directory traversal. So I set GCDWebServerOption_MaxPendingConnections=64. Now I seldom see "stuck" above and speed of directory traversal is remarkably improved.