我正在尝试使用以下代码连接到 localhost ( TOR ) 上的端口 9150:
WORD wVersionRequested = MAKEWORD(2,0);
WSADATA wsaData;
if(WSAStartup(wVersionRequested,&wsaData) != 0)
{
return 1;
}
int fd = socket(AF_INET, SOCK_STREAM, 0);
if(fd < 0)
{
printf("error 0");
}
struct sockaddr_in saddr;
saddr.sin_port = htons(9150);
saddr.sin_family = AF_INET;
saddr.sin_addr.s_addr = inet_addr("127.0.0.1");
connect(fd, (struct sockaddr *)&saddr, sizeof(saddr));
if(fd > 0)
{
printf("error 1");
}
并以“错误1”失败。TOR/Vidalia 正在这个端口上运行,一切正常,所以错误必须在我的代码中。请帮帮我。