Fixed it.
As it turned out, when you debug the first time after rebooting the robot, everything works fine. The second time you debug, the crash is caused by an IOException thrown in SocketServerStreamProvider::SocketServerStreamProv ider(int port).
The crash happened because the cRIO's user code (ours) attempted to bind a socket that had already been bound by a previous debugging session.
It can be fixed quite easily by inserting the following code somewhere (anywhere) between the call to setsockopt(...SO_REUSEADDR...) and the call to bind():
Code:
// NWR2013 - Set the port as reusable too.
if (setsockopt(serverSocket, SOL_SOCKET, SO_REUSEPORT, (char*) &reuseAddr, sizeof(reuseAddr)) == ERROR)
{
printf("[SocketServerStreamProvider] Unable to mark the server socket port as reusable! Reason: %s\n", strerror(errno));
return;
}