Reputation: 4451
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.
Upvotes: 0
Views: 3481
Reputation: 1
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.
Upvotes: 0
Reputation: 320
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
Upvotes: 1
Reputation: 4008
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.
Upvotes: 1