Okay, so in fact I have another problem but related I guess.
I have my udp socket and I can check and find the server on the network and it works fine. But I can't connect with TCP to the server after that. The clients seems to be able to connect but the server does not react. If I don't send data with UDP before, I can connect to the tcplistener, but otherwise not. The TCP port and the UDP are different.
Here's the server side function.
if(selector.wait())
{
if(selector.isReady(listener)) // If there's a pending connection
{
// SFML DOC LIKE
}
if(selector.isReady(udp_socket))
{
sf::Socket::Status st = udp_socket.receive(pack,sender_ip,sender_port)
// if what I received is correct I answer something to the client who sent the pack
udp_socket.send(pack,sender_ip,sender_port);
}
}
And here is where I try to connect with the client.
for(int i = first_addr; i < last_addr;i++)
udp_socket.send(pack,test,udp_port); // Sent on every adress between first and last (test is a string which contains the full adress)
udp_socket.bind(udp_port);
udp_socket.setBlocking(false);
udp_socket.receive(pack,server,server_port);
udp_socket.unbind();
After that, I get the adress of the server who sent the pack and I try to connect to with the TCP port (which is not the same as the UDP one).
I also tested the TCP connection directly on the server with a simple program and it works.
I don't get why it does this.
Edit: Removed a lot of not related code