| | #1 |
| Warrior Member Join Date: 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
Hi, I recently bought shared hosting at asphostportal.com. Now, I have little problem. Could you help me please? 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 49.50.53.49 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 |
| |
| | #2 |
| VIP Warrior War Room Member Join Date: 2006 Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
| |
| |
|
| Bookmarks |
| Tags |
| assign, sockaddrin, struct |
| |