Hello,
I am very new to networking with Swift, so I greatly appreciate anyone who can assist me here. I'm trying to get a basic proxy server working on an iOS device, using the code found at the SwiftNIO official example.. On the command line, it works great! However, I have been unable to successfully connect to the server when running on my phone (not a simulator). My phone and computer are on the same network.
In the Xcode console, it logs that is it is successfully listening on the designated ports:
2022-06-21T13:16:44-0400 info com.apple.nio-connect-proxy.main : [NetworkTests] Listening on Optional([IPv6]::1/::1:8080)
2022-06-21T13:16:44-0400 info com.apple.nio-connect-proxy.main : [NetworkTests] Listening on Optional([IPv4]127.0.0.1/127.0.0.1:8080)
But when I attempt to connect to it using curl -v -x http://[my phone's 172.20 ip]:8080 https://apple.com
, I receive the following error message in my Mac terminal:
* Trying 172.[ip]:8080...
* connect to 127.[ip] port 8080 failed: Connection refused
* Trying ::1:8080...
* connect to ::1 port 8080 failed: Connection refused
* Failed to connect to localhost port 8080 after 14 ms: Connection refused
* Closing connection 0
curl: (7) Failed to connect to localhost port 8080 after 14 ms: Connection refused
Thank you to anyone who can offer any advice. I''m happy to clarify anything!