-3

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 :(

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
  • 1
    Sorry, we're here to help with specific problems, not be your teachers. – Marc B Sep 11 '13 at 15:02
  • As Marc said, google some stuff about that and if you find yourself in trouble then ask again, but be more specific. – Kelu Thatsall Sep 11 '13 at 15:03
  • 1
    I'd recommend starting with Beej's Guide to Network Programming (http://beej.us/guide/bgnet/). That will at least give you a pretty good start. Once you've read and internalized the guide, then come back with any questions you'll have. – Ross Sep 11 '13 at 15:06
  • ive been googling allday and everything i google just springs up more questions lol. ok i suppose my main question is what libarys can i use to ping? – user2769011 Sep 11 '13 at 15:19

1 Answers1

0

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.

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547