send() error.: Socket operation on non-socket 已导致不能发送错误,虽然这个错误时出现在send()调用,但是其错误源头在accept()调用,我调试时,打印了accept()返回值居然是0,mygod…… 原因: 在accept()调用的时候出现了。运算符优先级错误。汗……一个低级错误,郁闷了我昨天一个下午。 原函数错误写法是: if...
if((sockfd=socket(AF_INET,SOCK_STREAM,0))==-1)// 极为容易出错,函数()跟一个值比较,尤其是类似于 变量1=函数(),这样的形式,=号的优先级为14,要远远低于==,<,>, { fprintf(stderr,"socket error:%s\n\a",strerror(errno)); exit(1); } bzero(&server_addr,sizeof(struct sockaddr_in)); ...
你把bind(sockfd,(struct sockaddr *)&my_addr,sizeof(struct sockaddr)改为 bind(sockfd,(struct sockaddr *)&my_addr,sizeof(my_addr) 试试,我看了下代码,没什么问题啊。
memset(ServAddr.sin_zero, 0, sizeof(struct sockaddr_in));您真有趣……
1. 建⽴socket:if(listenfd= socket(AF_INET,SOCK_STREAM, 0)==-1){ perror("creating socket failed!");exit(-1);} 会造成在bind时出现 Socket operation on non-socket错误 正确的代码应该是:if((listenfd = socket(AF_INET, SOCK_STREAM, 0)) == -1){ perror("creating socket failed!")...
" Socket operation on non-socket" 非常感谢你的建议, #if defined(linux) #include <pthread.h> /* Socket specific functions and constants */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #inc 浏览1提问于2009-12-10得票数 6 回答已采纳...
socket_connection=socket(AF_INET,SOCK_STREAM) socket_connection.bind(port,ip_add) socket_connection.listen(10) while 1 : attacker_connection,attacker_addr = socket_connection.accept() print("Decoy Server Is Created on The Attacker".format(attacker_addr[0])) ...
An operation was attempted on something that is not a socket. This error is returned if the descriptor in the s parameter is not a socket.HinweiseThe bind function is required on an unconnected socket before subsequent calls to the listen function. It is normally used to bind to either conne...
If lighttpd.conf is configured with"bin-path"to create the socket and run the backend, and ifsomething elsedeletes the socket in /tmp, then lighttpd is managing a backend PHP process which is alive (has not exited) and listening on a socket that has been unlinked from the filesystem. Ne...
An HAProxy cannot bind socket error message is generated when there is another process listening on the same interface and TCP port combination that HAProxy …