Bom dia, pessoal. Fiz um Scanner de portas em C, porém está dando alguns erros e não sei como resolver. Se alguém puder me ajudar a resolver eu agradeço demais! Segue abaixo os erros que estão dando e o código do Scanner.
#include<stdio.h>#include<sys/socket.h>#include<errno.h>#include<netdb.h>#include<string.h>#include<stdlib.h> int main(int argc , char **argv){ struct hostent *host; int err, i , sock , inicio , final; char hostname[100]; struct sockaddr_in sa; printf("Entre com hostname ou IP : "); gets(hostname); printf("\nEntre com o numero da porta inicial : "); scanf("%d" , &inicio); [= printf("Entre com o numero da porta final : "); scanf("%d" , &final); strncpy((char*)&sa , "" , sizeof sa); sa.sin_family = AF_INET; if(isdigit(hostname[0])) { printf("Fazendo inet_addr..."); sa.sin_addr.s_addr = inet_addr(hostname); printf("Feito\n"); } else if( (host = gethostbyname(hostname)) != 0) { printf("Obtendo host pelo nome..."); strncpy((char*)&sa.sin_addr , (char*)host->h_addr , sizeof sa.sin_addr); printf("Feito\n"); } else { herror(hostname); exit(2); } printf("Iniciando varredura de portas : \n"); for( i = inicio ; i <= final ; i++) { sa.sin_port = htons(i); sock = socket(AF_INET , SOCK_STREAM , 0); if(sock < 0) { perror("\nSocket"); exit(1); } err = connect(sock , (struct sockaddr*)&sa , sizeof sa); if( err < 0 ) { fflush(stdout); } else { printf("%-5d aberta\n", i); } close(sock); } printf("\r"); fflush(stdout); return(0);}