Basically title. My UDP sockets block fine but my TCP Sockets wont block. I'm sure they can block but am I wrong? I've tried using a selector but have the same results.
Client Side:
sf::TcpSocket serverSocket;
serverSocket.setBlocking(true);
sf::Socket::Status status = serverSocket.connect(serverIP, 5645);
if(serverSocket.receive(serverData) != sf::Socket::Done)
{
//error
}
Server Side:
sf::SocketSelector selector;
sf::TcpListener listenerSocket;
if (listenerSocket.listen(5645) != sf::Socket::Done)
{
std::cout << "Failed to bind listener socket\n";
}
selector.add(listenerSocket);
if (selector.wait(portCheckTime))
{
// Test the listener
if (selector.isReady(listenerSocket))
{
sf::TcpSocket client;
if (listenerSocket.accept(client) == sf::Socket::Done)
{
std::cout << "A client has joined\n";
}
if (client.send(serverData) == sf::Socket::Done)
{
if (iteration == 1)
{
iteration = 2;
}
else if (iteration == 2)
{
iteration = 1;
}
socket++;
}