This works using "127.0.0.1" as the port as well as over a local network using "Name-PC". Yet when i tested this out with a friend the client couldn't connect to the server ( The programs were allowed through the firewalls). I have googled this problem and found nothing, so i'm guessing the solution is either really simple, or i'm barking up the wrong tree. Any help is appreciated.
Did You recover the error that was returned by the connect function?...
You should not use gethostbyname() any more...
Try using getaddrinfo() instead.
It copies everything in the right format into the sockaddr-structure contained by its own addrinfo structure (in the needed network order formats)...
Are You really sure, that the Ports you are using are opened on your router -if You are using one-, too?...