X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/0f45342a680ac4a02816e71b8550dbc3610391c0..91fb3ca6b56328c626dabb35e2de9a5ae525b1b1:/practicas/pipi/src/libtcp.c?ds=inline diff --git a/practicas/pipi/src/libtcp.c b/practicas/pipi/src/libtcp.c index a3aea62..3184ff2 100644 --- a/practicas/pipi/src/libtcp.c +++ b/practicas/pipi/src/libtcp.c @@ -95,22 +95,28 @@ int libtcp_open_pasivo (int port) return -1; } +#ifdef DEBUG_LIBTCP sprintf (mostrar, "LibTcp::ServerPasivo: socket creado %d\n", sockfd); write (fileno(stdout), mostrar, strlen (mostrar)); +#endif /* Vincular el socket con la direccion local */ if (bind (sockfd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) { return -1; } +#ifdef DEBUG_LIBTCP sprintf (mostrar, "LibTcp::Server: se hizo el bind\n"); write(fileno(stdout), mostrar, strlen(mostrar)); +#endif /* Definir la cola de espera = hasta 5 clientes */ listen(sockfd, 5); +#ifdef DEBUG_LIBTCP sprintf (mostrar, "LibTcp::Server: se hizo el listen con el socket %d\n", sockfd); write(fileno(stdout), mostrar, strlen(mostrar)); +#endif return sockfd; }