Mar 2nd, 2008, 10:34 AM
|
#3
|
|
Hobbyist Programmer
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 243
Rep Power: 3 
|
Re: Simple BSD Sockets Problem
Quote:
Originally Posted by Game_Ender
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.
|
Thanks for the reply. There is no server code. The host I connect to is an IRC network host.
|
|
|