当前位置: 技术问答>linux和unix
socket非阻塞模式出现operation now in process ,请大家帮忙看看!
来源: 互联网 发布时间:2016-05-08
本文导语: 代码如下: #include /* for printf() and fprintf() */ #include /* for socket() and bind() */ #include /* for sockaddr_in and inet_ntoa() */ #include /* for atoi() */ #include /* for memset() */ #include /*...
代码如下:
#include /* for printf() and fprintf() */
#include /* for socket() and bind() */
#include /* for sockaddr_in and inet_ntoa() */
#include /* for atoi() */
#include /* for memset() */
#include /* for close() */
#include
#define TCPCLIENTPORT 10000
#define BUFFERSIZE 256
int main()
{
struct sockaddr_in s_addr;
struct sockaddr_in c_addr;
int sock,tcpsock;
socklen_t addr_len;
int len,tcplen;
char buff[BUFFERSIZE],tcprecvbuff[BUFFERSIZE];
struct sockaddr_in tcp_seraddr;
char *SerIP = "192.168.1.115";
if ((tcpsock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP))