Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I get arpa/inet.h?

Question is really simple. I need a tool to convert char* to ip adress and use it in

sockaddr_in.s_addr

arpa/inet.h has inet_addr() function, but I am not sure if I already have this file somewhere in MS VS 2010 installation or should I get it elsewhere.

like image 818
Pavel Oganesyan Avatar asked Dec 12 '13 12:12

Pavel Oganesyan


People also ask

What is ARPA INET h in C?

The arpa/inet. h header file contains definitions for internet operations.

How do I use ARPA INET h in Windows?

arpa/inet. h is the include used on Unix-like systems. On Windows, you must use winsock2. h .


2 Answers

Win32 provides its own implementation of the sockets API (Winsock) which uses slightly different headers.

From the MSDN for inet_addr:

Header Winsock2.h

like image 71
ComicSansMS Avatar answered Sep 27 '22 23:09

ComicSansMS


arpa/inet.h is the include used on Unix-like systems.

On Windows, you must use winsock2.h.

Example from the MSDN.

like image 45
Louis Brunner Avatar answered Sep 28 '22 01:09

Louis Brunner