سؤال

BackGround: I am used to working with windows and using an IDE to create a project for example visual studios. But the task i am on now is using linux, Gedit and G++ and i have no experience what so ever.

Task I'm trying to write a program which will ping devices on a network and gather some relevant information. I need to do this with out using any IDE and eventually it will have to be a piece of standalone code to be used inside a box.

what i think i need todo I think i need to find a library with the relevant functions which will set up the sockets and all the other details. But other than that im not sure where to go.

Please could some one educate me here, I feel like a fish out of water. where do i start :(

هل كانت مفيدة؟

المحلول

I believe that by pinging devices on the network you mean ICMP, see also icmp(7).

The obvious way of understanding how to do that on Linux is to take advantage that it is made of free software and to get the source code related to the ping command (on Debian & Ubuntu in the inetutils-ping package). Also, you could strace some ping command (to understand the relevant syscalls, see also syscalls(2) and the Advanced Linux Programming book).

I strongly suggest to take the habit of compiling and studying and improving free software.

You could also use the libping library; you'll probably need root privileges.

For tips about C & C++ development on Linux see this answer.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top