Monday, 15 March 2010

Is Network Up? C++ Fedora/Unix -


Does anyone have a snippet of their code, it checks whether the network is enabled on the machine and the active IP address.

I have a networking software that connects to other client machines, though it works, when the machine is connected, but if I unplug the cable or disable the network It throws a whole remix of exceptions.

It would be good to put an inquiry at the top: D

Thanks in advance

The network is always in a dynamic position, at the beginning of the run, a simple test is not enough for the right operation. Unfortunately, you have to check the state's success for any network operation.

Not for the program that started with the network disconnected state ... Please consider that your program has started automatically after the crash or the power failure or if any other component It has done something like this, or a mess it is surprisingly often, and restarting the program on the n + 1 computer, because some DVB has stumbled on the network cable is very upset.

The network To check the general availability of the King, if you do not always respond to "ping-c-1 127.0.0.1", the return value is 1. It should be in startup script, it should be unnecessary for the code in the application.


No comments:

Post a Comment