How to implement ping program

Hi, I'm a new to Linux Network program, and now I want to implement ping in C socket based on Linux OS. When the peer side isn't open the firewall, my programe can ping successfully, but when the peer side is open the firewall, In this case, my programe failure! I want to know when the peer side is open the firewall, How can I implement my ping program? Think you!
It's not a specifically Linux problem.

Why not rely on the program's failure to connect out to determine the state of the firewall? Why do you need a separate ping to do that?
Topic archived. No new replies allowed.