• Viernes 19 de Abril de 2024, 01:52

Autor Tema:  Ahorcado cliente servidor TCP  (Leído 3278 veces)

antlcn

  • Nuevo Miembro
  • *
  • Mensajes: 12
    • Ver Perfil
Ahorcado cliente servidor TCP
« en: Lunes 16 de Abril de 2012, 09:37 »
0
Hola, estoy trabajando en el juego del ahorcado donde existe un servidor al que pueden conectarse varios clientes y jugar partidas individuales simultaneas gracias a la funcion select(). El caso es que al compilar "servidor.c" todo va bien pero lo ejecuto y me devuelve el siguiente error:


*** glibc detected *** ./servidor: corrupted double-linked list: 0x09310168 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6c0c1)[0x17c0c1]
/lib/libc.so.6(+0x6d9f3)[0x17d9f3]
/lib/libc.so.6(cfree+0x6d)[0x180a1d]
/lib/libc.so.6(fclose+0x14a)[0x16c3da]
./servidor[0x8048ad2]
./servidor[0x80492d0]
/lib/libc.so.6(__libc_start_main+0xe7)[0x126ce7]
./servidor[0x8048931]
======= Memory map: ========
00110000-00267000 r-xp 00000000 07:00 21126      /lib/libc-2.12.1.so
00267000-00269000 r--p 00157000 07:00 21126      /lib/libc-2.12.1.so
00269000-0026a000 rw-p 00159000 07:00 21126      /lib/libc-2.12.1.so
0026a000-0026d000 rw-p 00000000 00:00 0
00381000-0039b000 r-xp 00000000 07:00 95         /lib/libgcc_s.so.1
0039b000-0039c000 r--p 00019000 07:00 95         /lib/libgcc_s.so.1
0039c000-0039d000 rw-p 0001a000 07:00 95         /lib/libgcc_s.so.1
003e8000-003e9000 r-xp 00000000 00:00 0          [vdso]
0081c000-00838000 r-xp 00000000 07:00 21110      /lib/ld-2.12.1.so
00838000-00839000 r--p 0001b000 07:00 21110      /lib/ld-2.12.1.so
00839000-0083a000 rw-p 0001c000 07:00 21110      /lib/ld-2.12.1.so
08048000-0804b000 r-xp 00000000 08:05 5213       /"RUTA FICHERO"/
0804b000-0804c000 r--p 00002000 08:05 5213        /"RUTA FICHERO"/
0804c000-0804d000 rw-p 00003000 08:05 5213        /"RUTA FICHERO"/
09310000-09331000 rw-p 00000000 00:00 0          [heap]
b7600000-b7621000 rw-p 00000000 00:00 0
b7621000-b7700000 ---p 00000000 00:00 0
b77b4000-b77b5000 rw-p 00000000 00:00 0
b77c9000-b77cb000 rw-p 00000000 00:00 0
bfada000-bfafb000 rw-p 00000000 00:00 0          [stack]
Abortado


Aquí dejo mi código:

Código: C
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/socket.h>
  4. #include <netinet/in.h>
  5. #include <netdb.h>
  6. #include <string.h>
  7. #include <stdlib.h>
  8. #include <signal.h>
  9. #include <time.h>
  10. #include "funciones.c"
  11.  
  12.  
  13. void quitHandler(int sig);
  14.  
  15. int socketDes=-1; //socket del servidor
  16.  
  17. int main(void)
  18. {
  19.         /*---------------------------------------
  20.     Descriptor del socket y buffer de datos
  21.     ---------------------------------------*/
  22.  
  23.        
  24.         struct sockaddr_in sockname, from;
  25.         char buffer[200];
  26.         int from_len;
  27.  
  28.         struct hostent* host;
  29.  
  30.         /*-----------------
  31.     Se abre el socket
  32.     -----------------*/
  33.         socketDes = socket (AF_INET, SOCK_STREAM, 0);
  34.     if (socketDes == -1)
  35.     {
  36.       perror ("No se puede abrir el socket servidor");
  37.       exit(-1);
  38.     }
  39.  
  40.     /*------------------------------------------------------
  41.     Se rellenan los campos de la estructura con la IP del
  42.     servidor y el puerto del servicio que ofrecemos
  43.     ------------------------------------------------------*/
  44.  
  45.     sockname.sin_family = AF_INET;
  46.     sockname.sin_port = htons(2050);
  47.     sockname.sin_addr.s_addr = INADDR_ANY;
  48.  
  49.     if (bind (socketDes, (struct sockaddr*)&sockname, sizeof(sockname)) == -1)
  50.     {
  51.       perror("Error en la operacion bind");
  52.       close (socketDes);
  53.       exit(-1);
  54.     }
  55.  
  56.  
  57.     from_len = sizeof(from);
  58.  
  59.     if (listen(socketDes,1) == -1)
  60.     {
  61.       perror("Error en la operacion de listen");
  62.       close (socketDes);
  63.       exit(-1);
  64.     }
  65.  
  66.     signal(SIGINT, quitHandler);
  67.         signal(SIGTSTP, quitHandler);
  68.  
  69.     /*--------------------------------
  70.       Aceptar peticiones de clientes
  71.       -------------------------------*/
  72.     char **refranes;
  73.     int numRefranes;
  74.     struct cliente infoCli;
  75.  
  76.     int infoSelect;
  77.     int numClientesIn=0;
  78.  
  79.     int socketEntrada, newSocket;
  80.  
  81.     int i=0,j=0;
  82.  
  83.     char kword[30];
  84.     char bufferAux[200];
  85.     char *cadAux, *cadAux1;
  86.     int index=0, index1=0;
  87.     char letra;
  88.  
  89.     struct cliente auxCli;
  90.  
  91.     fd_set sockIn;
  92.     fd_set sockAux;
  93.  
  94.     FD_ZERO(&sockIn);
  95.     FD_ZERO(&sockAux);
  96.  
  97.     FD_SET(socketDes,&sockIn);
  98.  
  99.     refranes=extraeRefranes(&numRefranes);   //cargamos refranes desde fichero
  100.  
  101.  
  102.     while(1)   //bucle para el continuo analisis de peticiones de entrada
  103.     {
  104.         sockAux=sockIn;  //FD_COPY(&sockIn, &sockAux);
  105.  
  106.         infoSelect=select(FD_SETSIZE,&sockIn,NULL,NULL,NULL);
  107.         if(infoSelect==-1)
  108.         {
  109.                 perror("\nError en la funcion select()\n");
  110.                 exit(1);
  111.         }
  112.         else
  113.         {
  114.                 socketEntrada=buscarSocket(&sockIn);
  115.                 if(socketEntrada>=0)
  116.                 {
  117.                         if(recv(socketEntrada,buffer,200,0)==-1)
  118.                                 printf("\nError en la recepcion con -recv-\n");
  119.                         else
  120.                         {
  121.                                 i=0;
  122.                                         do
  123.                                         {
  124.                                                 kword[i]=buffer[i];
  125.                                                 i++;
  126.                                         }while(buffer[i]!=' ' && buffer[i]!='\0');
  127.                                         kword[i]='\0';
  128.  
  129.                                         if(strcmp(kword, "USUARIO")==0)  //se introdujo la clave USUARIO
  130.                                         {
  131.                                                 cadAux=buffer+8;
  132.                                                 auxCli=buscaClienteNombre(cadAux);
  133.  
  134.                                                 if(auxCli.registrado!=1)
  135.                                                 {
  136.                                                         strcpy(buffer,"-Err. Usuario incorrecto");
  137.                                                         if(send(socketEntrada,buffer,200,0)==-1)
  138.                                                                 perror("\nSe produjo un erro al enviar\n");
  139.                                                 }
  140.                                                 else
  141.                                                 {
  142.                                                         if(auxCli.loggeado!=1)
  143.                                                         {
  144.                                                                 auxCli.loggeado=1;
  145.                                                                 auxCli.numSocket= socketEntrada;
  146.                                                                 modificarCliente(auxCli);
  147.                                                         }
  148.  
  149.                                                         strcpy(buffer,"-Ok. Usuario correcto");
  150.                                                         if(send(socketEntrada,buffer,200,0)==-1)
  151.                                                                 perror("\nSe produjo un erro al enviar\n");
  152.                                                 }
  153.                                                
  154.                                         }//fin opcion USUARIO
  155.  
  156.                                         if(strcmp(kword,"PASSWORD")==0)  //se introdujo la clav PASSWORD
  157.                                         {
  158.                                                 cadAux=buffer+9; //esta es la contraseña
  159.  
  160.                                                 auxCli=buscaCliente(socketEntrada);
  161.                                                 //puede ser NULL??????????????????????
  162.                                                 if(auxCli.loggeado==1 && (strcmp(auxCli.passUser,cadAux)==0))
  163.                                                 {
  164.                                                         strcpy(buffer, "+Ok. Usuario validado");
  165.                                             if(send(socketEntrada, buffer, 200, 0) == -1)
  166.                                                             perror("Error en el envio");
  167.                                                        
  168.                                                         modificarCliente(auxCli);  //se incluye la informacion en el fichero
  169.                                                 }
  170.                                                 else
  171.                                                 {
  172.                                                         strcpy(buffer, "-Err. Error en la validacion");
  173.                                             if(send(socketEntrada, buffer, 200, 0) == -1)
  174.                                                             perror("Error en el envio");
  175.                                                 }
  176.  
  177.                                                
  178.                                         }//fin opcion PASSWORD
  179.  
  180.  
  181.                                         if(strcmp(kword,"REGISTRO")==0)  //se introdujo la clave REGISTRO
  182.                                         {
  183.                                                 for(i=0;i<=strlen(buffer);i++)
  184.                                                 {
  185.                                                         if(buffer[i]=='-' && buffer[i+1]=='u')
  186.                                                         {
  187.                                                                 index=i+3;
  188.                                                                 cadAux=buffer+index; //aqui esta el usuario
  189.                                                         }
  190.                                                         if(buffer[i]=='-' && buffer[i+1]=='p')
  191.                                                         {
  192.                                                                 cadAux1=buffer+(i+3); //aqui la contraseña
  193.                                                                 index1=i;
  194.                                                         }
  195.                                                 }
  196.                                                 cadAux[index1-index-1]='\0';
  197.  
  198.                                                 auxCli=buscaClienteNombre(cadAux);
  199.  
  200.                                                 if(auxCli.registrado!=1)
  201.                                                 {
  202.                                                         auxCli.numSocket=0;
  203.                                                         auxCli.jugando=0;
  204.                                                         auxCli.registrado=1;
  205.                                                         auxCli.loggeado=0;
  206.                                                         auxCli.autenticado=0;
  207.                                                         strcpy(auxCli.nombreUser,cadAux);
  208.                                                         strcpy(auxCli.passUser,cadAux1);
  209.                                                         auxCli.puntuacionPartida=0;
  210.                                                         auxCli.puntuacionTotal=0;
  211.                                                         auxCli.numIntentos=0;
  212.                                                         auxCli.numeroRefran=-1;
  213.                                                         auxCli.frasesAcertadas=0;
  214.                                                         auxCli.frasesFalladas=0;
  215.                                                         auxCli.modoJuego=-1;
  216.  
  217.                                                         introduceCliente(auxCli);
  218.  
  219.                                                         strcpy(buffer,"+Ok. Usuario registrado");
  220.                                                         if(send(socketEntrada,buffer,200,0)==-1)
  221.                                                                 perror("Error envio confirmacion registro");
  222.                                                 }
  223.                                                 else
  224.                                                 {
  225.                                                         strcpy(buffer,"-Err. Usuario ya existe");
  226.                                                         if(send(socketEntrada,buffer,200,0)==-1)
  227.                                                                 perror("Error envio respuesta registro");
  228.                                                 }
  229.                                                
  230.                                         } //fin opcion registro
  231.  
  232.                                         if(strcmp(kword,"VOCAL")==0)
  233.                                         {
  234.                                                 auxCli=buscaCliente(socketEntrada);
  235.  
  236.                                                 letra=buffer[6];
  237.                                                 if(letra=='a' || letra=='e' || letra=='i' || letra=='o' || letra=='u')
  238.                                                 {
  239.                                                         if(auxCli.modoJuego==0)
  240.                                                         {
  241.                                                                 if(compruebaLetra(refranes[auxCli.numeroRefran], auxCli.frasePartida, letra)==1)
  242.                                                                 {
  243.                                                                         strcpy(buffer,"+Ok. Existe la vocal ---> ");
  244.                                                                         strcat(buffer,auxCli.frasePartida);
  245.                                                                         if(send(socketEntrada,buffer,200,0)==-1)
  246.                                                                                 perror("\nError al enviar confirmacion vocal\n");
  247.                                                                 }
  248.                                                                 else
  249.                                                                 {
  250.                                                                         strcpy(buffer,"-Err. No existe la vocal ---> ");
  251.                                                                         strcat(buffer,auxCli.frasePartida);
  252.                                                                         if(send(socketEntrada,buffer,200,0)==-1)
  253.                                                                                 perror("\nError al enviar confirmacion vocal\n");
  254.                                                                 }
  255.  
  256.                                                                 auxCli.numIntentos++;
  257.                                                         }
  258.                                                 }
  259.                                                 else
  260.                                                 {
  261.                                                         strcpy(buffer,"-Err. Mensaje invalido");
  262.                                                         if(send(socketEntrada,buffer,200,0)==-1)
  263.                                                                 perror("\nError al enviar mensaje error\n");
  264.                                                 }
  265.  
  266.                                                
  267.  
  268.                                         } //fin opcion VOCAL
  269.  
  270.  
  271.  
  272.                                         if(strcmp(kword,"CONSONANTE")==0)
  273.                                         {
  274.                                                 auxCli=buscaCliente(socketEntrada);
  275.  
  276.                                                 letra=buffer[11];
  277.                                                 if(letra!='a' && letra!='e' && letra!='i' && letra!='o' && letra!='u')
  278.                                                 {
  279.                                                         if(auxCli.modoJuego==0)
  280.                                                         {
  281.                                                                 if(compruebaLetra(refranes[auxCli.numeroRefran], auxCli.frasePartida, letra)==1)
  282.                                                                 {
  283.                                                                         strcpy(buffer,"+Ok. Existe la consonante ---> ");
  284.                                                                         strcat(buffer,auxCli.frasePartida);
  285.                                                                         if(send(socketEntrada,buffer,200,0)==-1)
  286.                                                                                 perror("\nError al enviar confirmacion consonante\n");
  287.                                                                 }
  288.                                                                 else
  289.                                                                 {
  290.                                                                         strcpy(buffer,"-Err. No existe la consonante ---> ");
  291.                                                                         strcat(buffer,auxCli.frasePartida);
  292.                                                                         if(send(socketEntrada,buffer,200,0)==-1)
  293.                                                                                 perror("\nError al enviar confirmacion consonante\n");
  294.                                                                 }
  295.  
  296.                                                                 auxCli.numIntentos++;
  297.                                                         }
  298.                                                 }
  299.                                                 else
  300.                                                 {
  301.                                                         strcpy(buffer,"-Err. Mensaje invalido");
  302.                                                         if(send(socketEntrada,buffer,200,0)==-1)
  303.                                                                 perror("\nError al enviar mensaje error\n");
  304.                                                 }
  305.                                                
  306.  
  307.                                         } //fin opcion CONSONANTE
  308.  
  309.  
  310.                                         if(strcmp(kword,"RESOLVER")==0)
  311.                                         {
  312.                                                 auxCli=buscaCliente(socketEntrada);
  313.  
  314.                                                 if(auxCli.modoJuego==0)
  315.                                                 {
  316.                                                         if(strcmp(buffer+9,refranes[auxCli.numeroRefran])==0)
  317.                                                         {
  318.                                                                 if(auxCli.numIntentos<5)
  319.                                                                         auxCli.puntuacionPartida=150;
  320.                                                                 if(auxCli.numIntentos>=5 && auxCli.numIntentos<=8)
  321.                                                                         auxCli.puntuacionPartida=100;
  322.                                                                 if(auxCli.numIntentos>=9 && auxCli.numIntentos<=11)
  323.                                                                         auxCli.puntuacionPartida=70;
  324.                                                                 if(auxCli.numIntentos>=12 && auxCli.numIntentos<=15)
  325.                                                                         auxCli.puntuacionPartida=50;
  326.                                                                 if(auxCli.numIntentos>15)
  327.                                                                         auxCli.puntuacionPartida=0;
  328.  
  329.                                                                 auxCli.frasesAcertadas++;
  330.                                                                 auxCli.puntuacionTotal+=auxCli.puntuacionPartida;
  331.  
  332.                                                                 sprintf(bufferAux,"+Ok. Enhorabuena\n\n Puntuacion en esta partida: %d\nPuntuacion total: %d\nIntentos realizados: %d\nFrases acertadas: %d\nFrases fallidas: %d",auxCli.puntuacionPartida,auxCli.puntuacionTotal,auxCli.numIntentos,auxCli.frasesAcertadas,auxCli.frasesFalladas);
  333.                                                                 auxCli.puntuacionPartida=0;
  334.  
  335.                                                                 if(send(socketEntrada,bufferAux,200,0)==-1)
  336.                                                                         perror("\nError al enviar estadisticas\n");
  337.                                                         }
  338.                                                         else
  339.                                                         {
  340.                                                                 auxCli.frasesFalladas++;
  341.                                                                 sprintf(bufferAux,"-Err. Mejor suerte la proxima vez\n\n Puntuacion en esta partida: %d\nPuntuacion total: %d\nIntentos realizados: %d\nFrases acertadas: %d\nFrases fallidas: %d",auxCli.puntuacionPartida,auxCli.puntuacionTotal,auxCli.numIntentos,auxCli.frasesAcertadas,auxCli.frasesFalladas);
  342.                                                                 auxCli.puntuacionPartida=0;
  343.  
  344.                                                                 if(send(socketEntrada,bufferAux,200,0)==-1)
  345.                                                                         perror("\nError al enviar estadisticas\n");
  346.  
  347.                                                                 //reiniciamos la informacion del jugador
  348.                                                                 auxCli.jugando=0;
  349.                                                                 auxCli.modoJuego=-1;
  350.                                                                 auxCli.puntuacionPartida=0;
  351.                                                                 strcpy(auxCli.frasePartida,"");
  352.                                                                 auxCli.numIntentos=0;
  353.                                                                 auxCli.numeroRefran=-1;
  354.  
  355.                                                         }
  356.                                                 }
  357.                                                
  358.  
  359.                                         } //fin opcion RESOLVER
  360.  
  361.  
  362.                                         if(strcmp(kword,"PARTIDA-INDIVIDUAL")==0)
  363.                                         {
  364.                                                 auxCli=buscaCliente(socketEntrada);
  365.  
  366.                                                 if(auxCli.loggeado==1 && auxCli.registrado==1 && auxCli.autenticado==1)
  367.                                                 {
  368.                                                         if(auxCli.jugando==0)
  369.                                                         {
  370.                                                                 auxCli.jugando=1;
  371.                                                                 auxCli.modoJuego=0;
  372.  
  373.                                                                 srand(time(NULL));
  374.                                                                 auxCli.numeroRefran=rand()%numRefranes;
  375.  
  376.                                                                 strcpy(buffer,"");
  377.                                                                 j=0;
  378.                                                                 for(i=0;i<strlen(refranes[auxCli.numeroRefran]);i++)
  379.                                                                 {
  380.                                                                         switch(refranes[auxCli.numeroRefran][i])
  381.                                                                         {
  382.                                                                                 case ',':
  383.                                                                                         buffer[i]=',';
  384.                                                                                         break;
  385.                                                                                 case ' ':
  386.                                                                                         buffer[i]=' ';
  387.                                                                                         break;
  388.                                                                                 case '.':
  389.                                                                                         buffer[i]='.';
  390.                                                                                 default:
  391.                                                                                         buffer[i]='-';
  392.                                                                                         break;
  393.                                                                         }
  394.                                                                 }
  395.                                                                 buffer[i]='\0';
  396.                                                                 strcpy(auxCli.frasePartida,buffer);
  397.  
  398.                                                                 if (send(socketEntrada, buffer, 200, 0) == -1)
  399.                                                                         perror("\nError envio refran oculto\n");
  400.                                                         }
  401.                                                         else
  402.                                                         {
  403.                                                                 strcpy(buffer, "-Err. Ya tiene una partida en curso");
  404.                                                              if(send(socketEntrada, buffer, 200, 0) == -1)
  405.                                                                         perror("Error en el envio");
  406.                                                         }
  407.                                                 }
  408.                                                 else
  409.                                                 {
  410.                                                         strcpy(buffer, "-Err. Debe iniciar sesion antes de empezar");
  411.                                                     if(send(socketEntrada, buffer, 200, 0) == -1)
  412.                                                                 perror("\nError en el envio fallo partida nueva\n");;
  413.                                                 }
  414.                                                
  415.  
  416.                                         } //fin opcion PARTIDA-INDIVIDUAL
  417.  
  418.  
  419.                                         if(strcmp(kword,"PARTIDA-GRUPO")==0)
  420.                                         {
  421.                                                 //CODIGO PARA PARTIDA COLECTIVA
  422.                                         }
  423.  
  424.                                         if(strcmp(kword,"SALIR")==0)
  425.                                         {
  426.                                                 strcpy(buffer,"¡Hasta otra!");
  427.                                                 if(send(socketEntrada,buffer,200,0)==-1)
  428.                                                         perror("\nError en el envio de mensaje salida\n");
  429.                                                 close(socketEntrada);
  430.                                                 FD_CLR(socketEntrada,&sockAux);
  431.                                                 auxCli=buscaCliente(socketEntrada);
  432.  
  433.                                                 if(auxCli.registrado==1)
  434.                                                 {
  435.                                                         auxCli.numSocket=0;
  436.                                                         auxCli.jugando=0;
  437.                                                         auxCli.loggeado=0;
  438.                                                         auxCli.autenticado=0;
  439.                                                         auxCli.modoJuego=-1;
  440.                                                         strcpy(auxCli.frasePartida,"");
  441.                                                         auxCli.numeroRefran=-1;
  442.                                                         auxCli.frasesFalladas=0;
  443.                                                         auxCli.frasesAcertadas=0;
  444.                                                         auxCli.puntuacionPartida=0;
  445.                                                         auxCli.numIntentos=0;
  446.                                                 }
  447.  
  448.                                                 numClientesIn--;
  449.  
  450.                                         } //fin opcion SALIR
  451.  
  452.                         }//fin else de recepcion de mensaje
  453.  
  454.                         sockIn=sockAux;//FD_COPY(&sockAux,&sockIn);
  455.  
  456.                 }//fin if de existencia de socketEntrada
  457.                 else  //si no esta en el conjunto de sockets
  458.                 {
  459.                         if((newSocket=accept(socketDes,(struct sockaddr*)&from, &from_len))==-1)
  460.                         {
  461.                                 printf("\nError aceptando peticion de conexion\n");
  462.                                 exit(1);
  463.                         }
  464.                         else
  465.                                 numClientesIn++;
  466.                         if(numClientesIn>50)
  467.                         {
  468.                                 strcpy(buffer,"\n-Err. No se aceptan mas conexiones\n");
  469.                                 if(send(newSocket,buffer,200,0)==-1)
  470.                                         perror("\nError envio negacion conexion\n");
  471.                                 close(newSocket);
  472.                         }
  473.                         else
  474.                         {
  475.                                 printf("\n+Ok. Aceptada una nueva conexion, usuario nº %d",numClientesIn);
  476.  
  477.                                 auxCli.numSocket=newSocket;
  478.                                 auxCli.jugando=0;
  479.                                 auxCli.registrado=0;
  480.                                 auxCli.loggeado=0;
  481.                                 auxCli.autenticado=0;
  482.                                 auxCli.modoJuego=-1;
  483.                                 strcpy(auxCli.nombreUser,"");
  484.                                 strcpy(auxCli.passUser,"");
  485.                                 auxCli.puntuacionPartida=0;
  486.                                 auxCli.puntuacionTotal=0;
  487.                                 strcpy(auxCli.frasePartida,"");
  488.                                 auxCli.numIntentos=0;
  489.                                 auxCli.numeroRefran=-1;
  490.                                 auxCli.frasesAcertadas=0;
  491.                                 auxCli.frasesFalladas=0;
  492.  
  493.                                 introduceCliente(auxCli);
  494.                         }
  495.  
  496.                         sockIn=sockAux;//FD_COPY(&sockAux,&sockIn);
  497.  
  498.                         if(numClientesIn<50)
  499.                                 FD_SET(newSocket,&sockIn);
  500.                         sockAux=sockIn;//FD_COPY(&sockIn,&sockAux);
  501.                 }
  502.         }
  503.     }
  504.     return 0;
  505.  
  506. }
  507.  
  508. void quitHandler (int sig)
  509. {
  510.   close(socketDes);
  511.   printf("\nServidor terminado\n");
  512.   exit(0);
  513. }
  514.  




Gracias de antemano.

Un saludo!

Eternal Idol

  • Moderador
  • ******
  • Mensajes: 4696
  • Nacionalidad: ar
    • Ver Perfil
Re:Ahorcado cliente servidor TCP
« Respuesta #1 en: Lunes 16 de Abril de 2012, 15:47 »
0
Depura tu programa con gdb, primero generalo en version de depuracion asi podras ver cual es la pila cuando se produce el error en cuestion:

http://cs.baylor.edu/~donahoo/tools/gdb/tutorial.html


Nacional y Popular En mi país la bandera de Eva es inmortal.


Queremos una Argentina socialmente justa, económicamente libre y  políticamente soberana.
¡Perón cumple, Evita dignifica!


La mano invisible del mercado me robo la billetera.