Go to Post It's far easier to find ambiguity in the rules than to write them. - MikeE [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #17   Spotlight this post!  
Unread 01-21-2013, 10:29 PM
IBeMad IBeMad is offline
Registered User
FRC #3968
 
Join Date: Jan 2013
Location: Washington
Posts: 4
IBeMad is an unknown quantity at this point
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;
}
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:43 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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