My program sends commands to a different computer running a udp server.
My problem is that each different node is running on a different udp port and the code needs to take that into account by allowing the port to change depending on a int variable.
The to code snippets ive provided show what i got working and what i think should work but doesn't.
This Works.
This does not work.
My problem is that each different node is running on a different udp port and the code needs to take that into account by allowing the port to change depending on a int variable.
The to code snippets ive provided show what i got working and what i think should work but doesn't.
This Works.
Code:
const char* po = "49240";
if ((rv = getaddrinfo(lightIp, po, &hints, &servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
}
Code:
udpPort = 49240;
const char* po = (char*)udpPort;
if ((rv = getaddrinfo(lightIp, po, &hints, &servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
}
Comment