472,958 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

How to validate IPv4 & IPv6 in C?


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.
Feb 27 '10 #1
1 4795
9,065 Expert Mod 8TB
Use the function getaddrinfo (you can google it)
Feb 27 '10 #2

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

Similar topics

by: Agent | last post by:
I would like to invite you and your associates to attend the US IPv6 (Internet Protocol version 6) Summit, December 8-11, 2003 in Crystal City, VA, near the Pentagon. This major opportunity to...
by: Torsten Schmidt | last post by:
Hi, I'm trying to connect to a mysql-Server using PHP's mysql-function mysql_connect. The host on which the mysql-server is running is not the same as the host apache and php are running on. The...
by: MJ | last post by:
For some reason the following script does not work in Netscape/Mozilla, but works fine in IE and Opera. It is supposed to check the syntax, make sure there is a valid TLD (yes, those are all of...
by: PaulH | last post by:
I am attempting to write a functon that can perform IPv6 compliant pings. But, Icmp6SendEcho2 causes an access violation whenever it is called: First-chance exception at 0x76d641e8 in mping2.exe:...
by: prabhuram.k | last post by:
Can anybody know how to validate IPV4 and IPV6 address in PHP. I am using PHP 4.2.3 for some compatiability reason.
by: fusillo | last post by:
hi, i would like know about mysql's ipv6 support, i installed mysql 5.0.19 from a source dist and no configuration option is provided to enable ipv6. do you know some tips about? regards ...
by: numberwhun | last post by:
Hello everyone! I am still learning (TONS every day) and having an absolute blast. Unfortunately, I have an issue that is puzzling and bewildering me. Seeing as how the best way to learn is to...
by: Valerie Hough | last post by:
My app has so far only encountered IPv4 addresses and I use: Dns.GetHostByName( "someOtherComputer", portNumber ).AddressList. Can someone please point me to an example of how to turn this into...
by: =?Utf-8?B?V2lsbGlhbSBSYW5kbGV0dA==?= | last post by:
The System.Uri class is not behaving as I expect when an IPv4 address is embedded within an IPv6 address. The following test works fine, using IPv6 only: public void...
by: Simon | last post by:
Hi, is there a straight forward way of converting IPv4 to IPv6? I thought that it was just a matter of converting 32 bits to 128 bits, (by adding 96 leading 0s), but that does not seem right...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.