This post is effectively solved and needs to be marked as such, but for the reference of anyone coming along later, here's what happened:
The sin_addr contains a 32-bit unsigned long int. Not a string. 127.0.0.1 as a number would look like 0x7F000001 or 2130706433 in decimal. The numbers 49, 50, 55, 46 are the ASCII codes for '1', '2', '7', and '.' respectively. A memcpy would do a byte for byte copy of the string "127.0.0.1". I feel sorry for whoever's at 49.50.55.46. They must get this all the time.
Instead you need to use inet_pton (inet_aton is now deprecated).
For a more in-depth look at sockets, have a look at the venerated Beej's Guide to Network Programming.
When Chuck Norris wants to roundhouse kick a browser into existence, he asks Beej for advice first.