chrisj at rtems.org
Fri Oct 17 21:37:19 UTC 2008
Leon Pollak wrote:
> Hello, all.
> I need to exit from the application which uses networking.
> What is the proper way to close networking?
> The only thing relevant I found was rtems_bsdnet_detach(...), but nobody seems
> to call it...
> And I do not know how...:-(
> And it seems to me not the correct routine...
There is not single defined way to close networking. Your application should
close all sockets. For TCP you may need to consider the linger option. For UDP
sockets your application handling the protocol may need to signal a disconnect
to the remote end. Once all sockets are closed and you are happy the data has
been sent you could "down" the interface. Check the FreeBSD ifconfig man page
for details. The down option is documented as:
down Mark an interface ``down''. When an interface is marked
``down'', the system will not attempt to transmit messages
through that interface. If possible, the interface will be reset
to disable reception as well. This action does not automatically
disable routes using the interface.
After this there is nothing else you need to do.
The rtems_bsdnet_detach is available to provide a means for a specific driver
to release any hardware resources it has. If RTEMS ever needs hot swap or plug
and play support this can be used.
More information about the users