objecthub / swift-nanohttp

A tiny extensible and configurable HTTP server framework written in Swift for macOS, iOS, and Linux.
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Can not be accessed by another device in the same local network #1

Open lnhnjcsvps29893 opened 3 months ago

lnhnjcsvps29893 commented 3 months ago

I started a server on my iPhone (iOS 17.6 iPhone14 Pro) on 9080 port. I tried to access the server on the same phone, and it worked perfectly fine. But I couldn't access [IP]:9080 with my mac. Did I miss something?

image
objecthub commented 3 months ago

I just installed the iOS demo server that comes with NanoHTTP on my iPhone and had no problems connecting from my Mac, e.g. via telnet or Safari on the Mac. But, it's easy to mix up local IP addresses. I would disconnect the iPhone (from the Mac) after you installed the demo via Xcode and then maybe stop and restart the server. The latest code will display the local IP address which can be used to connect.

I hope this fixes the issue. If not, then it would be great if you could provide me with more details so that I can debug this.