Hello,
Im a portuguese student and is the first time I post in linux-net (Im sorry for my
english ). My question is why, when I execute the following program (ex. ./a.out
1.1.1.1 23), the telnet service goes down? (also the ftp service and some http
servers).
Miguel Biscaia
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc, char **argv)
{
struct sockaddr_in sock;
for(;;) {
int s=socket(AF_INET,SOCK_STREAM,0);
sock.sin_family=AF_INET;
sock.sin_port=htons(atoi(argv[2]));
sock.sin_addr.s_addr=inet_addr(argv[1]);
if(connect(s,(struct sockaddr *) &sock,sizeof(struct sockaddr))<0)
break;
}
return(0);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]