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