Help me

Pietro kpietro@inwind.it
Tue Feb 13 10:54:00 GMT 2001


Hello ML
I have the program for scan ports, in the which there is :

         sin.sin_family=AF_INET;
         sin.sin_port=htons(110);
         sin.sin_addr.s_addr=htonl(counter);
         addr.s_addr=htonl(counter);
         bzero(&(sin.sin_zero),
8);
        
         if
(connect(sock, (struct sockaddr*)&sin, sizeof(sin))==0)
          
{
           
read(sock, buffer, sizeof(buffer));
           if
(strstr(buffer, "QPOP") != NULL)
            
{
               
fprintf(stdout, "FOUND : %s\n", inet_ntoa(addr));
            
}
          }

With gcc -g -oprova prova.c   is ok! 
No error.
When run the program (prova) in the gdb, subsequently line
 if (connect(sock, (struct sockaddr*)&sin,
sizeof(sin))==0)
write the command print connect.
The result is :
$1 = {< text variable, no debug info >} 0x400c9ca0
<__libc_connect>
Why ?
The result of connect no egual -1 (error connecting) or 0 (connecting ok)
?

Help me
Thanks
Ciao by italy




More information about the Gcc-help mailing list