All Questions
Tagged with ip-address c++
111
questions
1
vote
1
answer
135
views
What does ai_addr contain?
I am currently learning socket programming and while programming I noticed that in a lot of functions you need to Pass in stuff from addrinfo*, and I understand what most of the stuff does. But my ...
0
votes
3
answers
564
views
Using Unions to convert an IP address into one 32-bit, two 16-bit, and four 8-bit values
I'm working on a school assignment. I am writing a program that utilizes unions to convert a given IP address in "192.168.1.10" format into its 32-bit single value, two 16-bit values, and ...
0
votes
0
answers
149
views
C/C++ - socket - I get a wrong client adress
I want to get the address of the client who sends a message to a server. I tried:
struct sockaddr_in client_sockaddr;
socklen_t tut = sizeof(sockaddr_in);
int valread;
int new_socket;
new_socket = ...
-2
votes
2
answers
1k
views
How to get IP Address from url without gethostbyname in Winsock API
I want to get IP Address from URL. I find the answer in google, it only has gethostbyname() function solution, but MSDN said that this function is not used anymore.
I try to use getaddressinfo() or ...
0
votes
1
answer
1k
views
Any suggestion on getting the Windows IP address of a machine in C++ (using Visual Studio 2019)?
I have put together a program using the sample program from:
https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersinfo
However, the problem I face is that when I list ...
4
votes
1
answer
786
views
Getting server IP within wasm application
I use C++ and Qt 5.15.x. I've built WebAssembly version of my desktop application.
The application is loaded using URL like "http://192.168.21.55:5555" (intranet application). I'd like to ...
0
votes
1
answer
175
views
How to display names and IP addresses of devices connected to a network using C++
I am making a program where I have to use TCP/IP connection to transmit and receive data between devices. I would like to be able to detect the names and IP addresses of all devices that are using the ...
0
votes
1
answer
320
views
How to Verify If two hostnames or i.p address points to same machine in c++
I have some machines and hostnames are defined for them. I want to write a c++ program that checks if both the hostnames points to different machine and execute some steps. If both of them points to ...
0
votes
1
answer
281
views
c++ Windows 10 Get an Ip for a connected client
I have set up a working WinSock2 Socket were a client can connect, how can I get the IP address of a connected client.
0
votes
1
answer
1k
views
Getting the destination IP of incoming UDP packet in C++
I found the function: GetTcpTable in C++. In the header: iphlpapi.h. That gives me the destination IP of TCP packet and I was wondering if there's a function from the same header that would give me ...
3
votes
4
answers
1k
views
Get computername from hostname in C++?
The IP address is 192.168.23.4. I am able to get the hostname from the ipaddress using the following code snippet:
struct sockaddr_in sa;
char str[INET_ADDRSTRLEN];
inet_pton(AF_INET, "192.168.23.4", ...
0
votes
1
answer
278
views
How to differentiate IP-addresses from domain names during parsing
I'm building an application where the user gets to specify the server to connect to, either by specifying the IP-address or domain name of the server. But how do I parse this input so the application ...
1
vote
1
answer
646
views
Why is in_addr6 not defined in netinet in Ubuntu 18.04.1?
I am currently building a cross-platform library in C that works with IP-addresses. So I thought that I could use the types in_addr and in_addr6 to represent the values since it looked like they would ...
0
votes
0
answers
50
views
What ip should I connect socket to when communicating between two machines(ZeroMQ)
What IP adress should be used to connect to server running on my pc from other machines? In my server, I call zmq_bind to listen for all incoming connections, like this:
zmq_bind(socket, "tcp://*:...
1
vote
2
answers
2k
views
How do I get my server Ip address for my websocket
I've created a server using c++ and crow that uses webSockets to communicate with the client (which is an ionic app). I've been do everything through localhost but now I want to deploy the webapp to ...