iOS Question Detecting a port

Tom2525

Member
Licensed User
Longtime User
Is there a way, when connected to a TCP server, to detect what port the app is connected to?
 

Tom2525

Member
Licensed User
Longtime User
The remote port. The user must select the remote port in the app and if the actual remote port doesn't match user selected remote port, I wanted to display a pop-up box that tells them.
 
Upvote 0

Tom2525

Member
Licensed User
Longtime User
You are passing the port to Socket.Connect.
Are you referring to SOCKET.Connect(ip, port, timeout)? If so, the port variable is set by the user. That doesn't accomplish what's needed. Here's a function example:

1. The user finds, lets say, four servers to connect to. Each one has the same IP but different ports.
2. The user selects server #2 (port 2002) in the wifi settings but has server #1 (port 2001) in the app.
3. The user tries to connect but can't. At this point, I'd like to say something like, "You are trying to connect to server #2 but server #1 is selected. Please adjust the server selection in your wifi settings or the server selection in the app.
 
Upvote 0

Tom2525

Member
Licensed User
Longtime User
What do you mean with wifi settings? Isn't it done inside your app?
When you connect to an access point, it must be selected in your wifi settings on your device first. I don't know of a way that an app can control that.

Settings -> Wi-Fi -> Choose a network
 
Upvote 0

Tom2525

Member
Licensed User
Longtime User
I never stated that the port is set in the wifi settings. When connecting to a TCP server, which is also an access point, the port needs to be specified in socket.connect. Is there a way, when connected to a TCP server, which is also an access point, to read what port the TCP server/access point is connected to? There's apps that already do it, like Fing, but I can't figure out how to do it with B4i.

If not, I can do this another way. Is there a way to read the access point name in B4i?
 
Upvote 0
Top