I am using SFML for my application and I use a socket to listen to the data being outputted by another application in the same machine. However, after a few cycles, the socket stops working. In blocking mode it completely freezes my application, while in non-blocking mode it fails to get the data and keeps using the last one before freezing. A snippet of the code used is below
sf::IpAddress Address = sf::IpAddress::LocalHost;
sf::TcpSocket socket;
socket.disconnect();
sf::TcpListener listener;
socket.connect(Address, port);
//socket.setBlocking(false);
void update()
{
std::size_t received;
if (socket.receive(buffer, sizeof(buffer), received)!= sf::Socket::Done)
printf("could not get data");
}
Any clues as to what might cause this issue? The data is generated trough a labview application and send 336 bytes burst at a time (I tried using the buffer smaller, bigger and exactly, with issues in all of them).
FSML 2.1, windows 7 32 bits, Visual Studio 10 express