freertos的例程是開啟了tcpclient,將代碼改成tcpserver后,啟動監(jiān)聽會失敗,返回錯誤代碼是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); }
熱門產品 :
CH585: 集成高速USB和NFC的藍牙MCU