Questions tagged [in-addr]

7 questions
101
votes
11 answers

How to convert string to IP address and vice versa

how can I convert a string ipAddress (struct in_addr) and vice versa? and how do I turn in unsigned long ipAddress? thanks
Safari
  • 11,437
  • 24
  • 91
  • 191
10
votes
2 answers

what are addresses of type in_addr_t inet_ntoa etc

Ok before posting this question I have checked threads here in_addr_t to string my question is different. I understand that inet_ntoa function is of following type char * inet_ntoa (struct in_addr in); What I want to know is what is in_addr_t what…
Registered User
  • 5,173
  • 16
  • 47
  • 73
4
votes
0 answers

Does INADDR_ANY care about new interface?

From reading from other posts understanding INADDR_ANY for socket programming - c INADDR_ANY is used when you don't need to bind a socket to a specific IP. When you use this value as the address when calling bind(), the socket accepts…
onmyway133
  • 45,645
  • 31
  • 257
  • 263
0
votes
1 answer

Hold lists of IPs and Host Names

I'm writing a proxy server, and I have a filter file that contains sub-networks (n1.n2.n3.n4/x) and host names. Each IP address that it first x MSB are identical to one from the list should be ignored, so as the host names. My initial thought was to…
RedYoel
  • 302
  • 2
  • 16
0
votes
1 answer

Compilation errors with VS-2019

The code below does not compile. I get two errors: _TCHAR* pStrAddress; ... some stuff here... IN_ADDR sa; InetPton(AF_INET, pStrAddress, &sa); *pIP = sa.S_un.S_addr; 1) IN_ADDR --> error C2065: 'AF_INET': undeclared…
BlackEagle
  • 11
  • 2
0
votes
1 answer

how do i get the Port from an in_addr value?

I am trying to extract the port from a given in_addr value in windows. So far I am able to get the IP address using inet_ntoa but not the port. Thanks.
Charles Okwuagwu
  • 10,538
  • 16
  • 87
  • 157
0
votes
2 answers

Using in_addr in C#

I'm trying to interact with a native DLL using P/Invoke, but it requires an in_addr struct parameter. I keep seeing many different kinds of definitions for it, but which is the best to use? Also, how can I convert a C# IPAddress object to an in_addr…
David Brown
  • 35,411
  • 11
  • 83
  • 132