467,910 Members | 1,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

How to validate IPv4 & IPv6 in C?

Hi,

I would like to write a program, and which is going to have multiple IP addresses (can be v4 or v6) as input, and on the return I need to print which IP addresses are valid and which aren't.

The term 'valid' means :
1. It is not necessary to have IP in same subnet / network.
2. It does not matter if given IP fails to ping.
3. For IPv4, there should be 4 bots, and all number have to be in between 0 to 255. [same for IPv6 also]

Any solution will be acceptable? using existing bulit-in libraries or manual parsing etc etc.

Thanks in advance.
Neal.
Feb 27 '10 #1
  • viewed: 4326
Share:
1 Reply
Banfa
Expert Mod 8TB
Use the function getaddrinfo (you can google it)
Feb 27 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Agent | last post: by
7 posts views Thread by Torsten Schmidt | last post: by
3 posts views Thread by MJ | last post: by
2 posts views Thread by PaulH | last post: by
2 posts views Thread by prabhuram.k | last post: by
3 posts views Thread by fusillo | last post: by
2 posts views Thread by Valerie Hough | last post: by
1 post views Thread by =?Utf-8?B?V2lsbGlhbSBSYW5kbGV0dA==?= | last post: by
14 posts views Thread by Simon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.