Hello everybody!
Working with the TcpSocket for some time now, I encountered a couple of problems using it. I think I will make new posts for the other ones in the future, but this one is really wierd and makes it kind of unusable.
Problem:Whenever I initialize a TcpSocket on Android and call its connect() method, wierd things happen. With my local ip it works just fine. It waits the specified amount of time for a connection and returns either status Error or status Done (just as you'd expect). This is the case on both Windows and Android. But with some (including my) public ips (just!) on Android, it seems to always recognize the ip as incorrectly formatted or something like that and returns status Disconnected immediately.
This is wierd because the exact same code behaves perfectly fine on Windows (and mabye other OSs), but becomes unusable on Android if you want to have it initiate a connection (the sf::TcpListener works fine too).
Minimal example (same for Android as for Windows):
#include <SFML/Networking.hpp>
int main() {
sf::TcpSocket socket;
socket.connect("SomePublicIp", 42069, sf::seconds(10));
return 0;
}
Additional info:I used Visual Studio 2022 and SFML-2.6.1 on Windows and the (btw SUPER convenient) App CxxDroid with SFML-2.5.1 already setup on Android. The version difference shouldn't matter since the changelog shows that only very little in the networking module changed, nothing to do with this problem I think.
Also (if it matters) I have set up port forwarding and am on different networks (one being my home router and the other one my phones mobile network). I additionally even restarted my router to get a new public Ip, but it doesn't work with this new one either. It now works (i.e. waits 10 seconds and returns status Error instead of instant status Disconnected) though with my old Ip, just as my router switched Ips! What's going on here?
Any help will be appreciated. Thanks in advance!