Socket Timeout in C++ Linux
问题 Ok first of all I like to mention what im doing is completely ethical and yes I am port scanning. The program runs fine when the port is open but when I get to a closed socket the program halts for a very long time because there is no time-out clause. Below is the following code int main(){ int err, net; struct hostent *host; struct sockaddr_in sa; sa.sin_family = AF_INET; sa.sin_port = htons(xxxx); sa.sin_addr.s_addr = inet_addr("xxx.xxx.xxx.xxx"); net = socket(AF_INET, SOCK_STREAM, IPPROTO