freertos的例程是开启了tcpclient,将代码改成tcpserver后,启动监听会失败,返回错误代码是0x11,将下面代码直接放到裸机代码程序中则不会失败。查错误码是WCHNET_ERR_MEM,注释Out of memory error,这个是要设置哪个内存的大小
void?WCHNET_CreateTcpSocketListen(void)? { ????u8?i; ????SOCK_INF?TmpSocketInf; ????memset((void?*)?&TmpSocketInf,?0,?sizeof(SOCK_INF)); ????memcpy((void?*)?TmpSocketInf.IPAddr,?IPAddr,?4); ????TmpSocketInf.SourPort?=?80; ????TmpSocketInf.ProtoType?=?PROTO_TYPE_TCP; ????i?=?WCHNET_SocketCreat(&SocketIdForListen,?&TmpSocketInf); ????printf("SocketIdForListen?%d\r\n",?SocketIdForListen); ????mStopIfError(i); ????i?=?WCHNET_SocketListen(SocketIdForListen);?????????//listen?for?connections ????mStopIfError(i); }
热门产品 :
CH634: 4端口USB3.0 HUB控制器芯片