void ClientCreate(struct addrinfo * addr,
const char* port) {
sockaddr_in service;
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr ; /* What do I put here? */
service.sin_port = (u_short)atoi(port);
I don't have to use inet_addr() I know have tried many possibility nothing works.
Also on the port the MSDN example used htons() but the above works.
Is there a better way to do it?
service.sin_addr.s_addr = inet_addr(What do I put here?);
It should be ip address of server,
//if server is localhost
service.sin_addr.s_addr = inet_addr("127.0.0.1");.
Also on the port the MSDN example used htons()
htons converts host byte order to network byte order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With