Solved the "cannot accept connection" problem.

This commit is contained in:
ha7ilm 2015-11-04 18:11:12 +01:00
parent 2b8101ddf6
commit e694e5a5b3

View file

@ -100,6 +100,7 @@ int main(int argc, char* argv[])
memset(&addr_host,'0',sizeof(addr_host));
addr_host.sin_family=AF_INET;
addr_host.sin_port=htons(host_port);
addr_host.sin_addr.s_addr = INADDR_ANY;
if( (addr_host.sin_addr.s_addr=inet_addr(host_address)) == INADDR_NONE )
{ fprintf(stderr, MSG_START "invalid host address.\n"); exit(1); }
@ -113,7 +114,7 @@ int main(int argc, char* argv[])
for(;;)
{
struct sockaddr_in addr_cli;
socklen_t addr_cli_len;
socklen_t addr_cli_len = sizeof(addr_cli);
int new_socket;
if( (new_socket = accept(listen_socket, (struct sockaddr*)&addr_cli, &addr_cli_len)) == -1)