Can someone point me to some tutorial on how to set up a ping method using C sockets? Using beej's guide, I've been able to set up a connection between two devices, but now I want to setup a method that pings for all available devices before starting an actual connection. I've never done this before, so would you do something like set up a multicast socket to broadcast an empty data packet and then have the receiver of that empty packet fill it with their IP address and return that now full data packet so that you have the address to start the connection? Any guide's/ help would be appreciated!
相关问题
- Multiple sockets for clients to connect to
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Disable Browser onUnload on certain links?
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How to create a CFuncType in Python
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Change loss function dynamically during training i
Why not just look at the ping source ;)
Most current IP stacks will not respond to a ping request to a broadcast address. The feature was abused for denial of service attacks.
Implementing a real ping implementation won't be easy, I'd suggest you use an existing lib: http://www.kernelthread.com/projects/hanoi/html/icmp.html
But you will have to manually iterate through all of the IP addrs on your subnet to get them to respond.