I seem to be having a bit of a weird problem with sockaddr / sockaddr_in structs... I want to manually assign the value of an IP address to the sockaddr_in struct, and I've been using memcpy
memcpy (&(mIp4sa->sin_addr.s_addr), "127.0.0.1", INET_ADDRSTRLEN);
But when I go to print out the IP address from the sockaddr_in struct using cout and inet_ntoa, I don't get the same address - in this case, I always seem to get 184.108.40.206 or something similiar :S
I've tried casting a char* with the ip address to void* and using it in memcpy and the same thing happens... is this just something thats not possible or am I doing it wrong?
Thanks in advance for any help :)