Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   NetworkTable crash in unmodified SimpleRobot template (http://www.chiefdelphi.com/forums/showthread.php?t=110627)

mitchellweb1 09-01-2013 16:12

Re: NetworkTable crash in unmodified SimpleRobot template
 
Can you post the actual output. Also make sure that you rebuild the WPILib project

IBeMad 21-01-2013 22:29

Re: NetworkTable crash in unmodified SimpleRobot template
 
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;
}



All times are GMT -5. The time now is 14:32.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi