Saludos estoy intentando hacer un programa para bloquear un puerto:
#include <windows.h>
int main(int argv, char **argc)
{
SOCKET sock;
struct sockaddr_in prmts;
char apagado[6]={'O','F','F',0x9,'3',0xd};
char _hostname[50];
struct hostent *host;
short int error;
WSAData wsaData;
WSAStartup(MAKEWORD(1,1),&wsaData);
gethostname( _hostname, 50);
host = gethostbyname(_hostname);
sock = socket(AF_INET,SOCK_STREAM,0);
prmts.sin_family = AF_INET;
prmts.sin_port= htons(2221);
prmts.sin_addr.s_addr = *((unsigned *)host -> h_addr_list[0]);
memset(&(prmts.sin_zero), '\0', 8);
while(1)
{
error = connect(sock, (struct sockaddr *)&prmts, sizeof(struct sockaddr));
if(error == 0) break;
else prmts.sin_port= htons(2222);
}
send(sock, apagado,6,0);
closesocket(sock);
return 0;
} [/i]
Al intentar compilarlo me da los siguientes errores:
[Linker error] undefined reference to WSAStartup@8'
gethostname@8'
[Linker error] undefined reference to
[Linker error] undefined reference to gethostbyname@4'
socket@12'
[Linker error] undefined reference to
[Linker error] undefined reference to htons@4'
connect@12'
[Linker error] undefined reference to
[Linker error] undefined reference to htons@4'
send@16'
[Linker error] undefined reference to
[Linker error] undefined reference to `closesocket@4'
Alguien sabe a que se puede deber???
Uso el Dev-C++ 4.9.8.0
Gracias .