Where is your server code?
Well you aren't check the return of "gethostbyname" which could very well be NULL. That would be a quick crash. You also don't zero out you sockaddr_in structure before using it. Here is some code I have that does a similar thing:
memset(&m_addr, 0, sizeof(m_addr));
m_addr.sin_family = AF_INET; // host byte order
m_addr.sin_port = htons(port); // short, network byte order
m_addr.sin_addr = *((struct in_addr *)he->h_addr);
I think you are trying to do something simular with this:
memset(their_addr.sin_zero, '\0', sizeof their_addr.sin_zero);
Wikipedia has good article
here.