Example Code:
#include <SFML/Network.hpp>
int main()
{
sf::TcpSocket socket;
sf::Socket::Status status = socket.connect("192.168.0.5", 53000);
if (status != sf::Socket::Done)
{
return -1;
}
return 0;
}
On my computer (Windows 8.1) this will always return 0; . I guess this isn't the expected behaviour, I tried it with serveral random IPs and it always returned "Done".
I tried it with a TimeOut aswell. The function will block the thread for the given time and then retrun sf::Socket::Done. Without a Timeout it will block the thread for a random time (near to 20seconds) and then also return sf::Socket::Done.
Do i missunderstand the API in this case? Or is it a bug?
AlexAUT
There are 2 cases we should really consider by themselves and not at the same time.
First we should try to figure out why sf::Socket::Done is returned on an unsuccessful connect() call.
What does this code output and what does it return when you run it?
#include <iostream>
#include <windows.h>
#include <SFML/Network.hpp>
int main()
{
std::cout << SOCKET_ERROR << "\n";
sf::TcpSocket socket;
sf::Socket::Status status = socket.connect("192.168.0.5", 53000);
std::cout << WSAGetLastError() << "\n";
if (status != sf::Socket::Done)
{
return -1;
}
return 0;
}