当前位置: 技术问答>linux和unix
我在linux下写了个简单的多线程端口扫描程序,运行时出现问题,请教一下!
来源: 互联网 发布时间:2016-01-24
本文导语: #include #include #include #include #include #include #include #include struct sockaddr_in servaddr; int g_nThreadNum, g_nMaxThread; long g_nNowPort; char *host; struct timeval timeout; static void* thread_scan_port(void *pPort) { int sockfd, flags, ...
#include
#include
#include
#include
#include
#include
#include
#include
struct sockaddr_in servaddr;
int g_nThreadNum, g_nMaxThread;
long g_nNowPort;
char *host;
struct timeval timeout;
static void* thread_scan_port(void *pPort)
{
int sockfd, flags, error,nPort, retconn, retval, len;
fd_set wfds;
pthread_detach(pthread_self());
nPort = *(int *)pPort;
//printf("nPort = %dn", nPort);
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd
#include
#include
#include
#include
#include
#include
#include
struct sockaddr_in servaddr;
int g_nThreadNum, g_nMaxThread;
long g_nNowPort;
char *host;
struct timeval timeout;
static void* thread_scan_port(void *pPort)
{
int sockfd, flags, error,nPort, retconn, retval, len;
fd_set wfds;
pthread_detach(pthread_self());
nPort = *(int *)pPort;
//printf("nPort = %dn", nPort);
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd