RAK439在网络异常,断网后经常不能重连



  • 在断网后,RAK_TcpClient函数每隔500-1000ms执行一次,频率已经很低了。但是还是一直不能连接服务器成功。服务器是重新打开的。如果把模块断电,就能连接到服务器。
    903 bsp.c:590 Host platform init...success
    5175 bsp.c:604 rak wifi LibVersion:1.0.7.1-2.1.41
    5236 bsp.c:608 rak wifi module-MAC:60:C5:A8:68:BE:2C
    9029 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    10041 tcp_udp.c:165 RAK_TcpClient sockfd = 1 creat
    17240 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    18253 tcp_udp.c:165 RAK_TcpClient sockfd = 2 creat
    135356 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    136370 tcp_udp.c:165 RAK_TcpClient sockfd = 3 creat
    143363 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    144377 tcp_udp.c:165 RAK_TcpClient sockfd = 4 creat
    151385 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    152384 tcp_udp.c:165 RAK_TcpClient sockfd = 5 creat
    159391 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    160405 tcp_udp.c:165 RAK_TcpClient sockfd = 6 creat
    167397 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    168411 tcp_udp.c:165 RAK_TcpClient sockfd = 7 creat
    200599 tcp_udp.c:41 RAK_TcpClient creating a TCP socket failed

    200674 tcp_udp.c:177 RAK_TcpClient creat failed
    201610 tcp_udp.c:41 RAK_TcpClient creating a TCP socket failed

    201685 tcp_udp.c:177 RAK_TcpClient creat failed
    202621 tcp_udp.c:41 RAK_TcpClient creating a TCP socket failed

    202696 tcp_udp.c:177 RAK_TcpClient creat failed
    203634 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    204650 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    205664 tcp_udp.c:64 RAK_TcpClient binding the TCP socket to the TCP server address failed

    206679 tcp_udp.c:64 RAK_TcpClient binding the TCP socket to the TCP server address failed

    206785 tcp_udp.c:177 RAK_TcpClient creat failed
    207707 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    208721 tcp_udp.c:165 RAK_TcpClient sockfd = 1 creat
    250581 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    251597 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    252611 tcp_udp.c:165 RAK_TcpClient sockfd = 2 creat
    254768 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    255784 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    256798 tcp_udp.c:165 RAK_TcpClient sockfd = 3 creat
    258969 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    259986 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    261001 tcp_udp.c:165 RAK_TcpClient sockfd = 4 creat
    263167 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    264181 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    265195 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    266209 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    267223 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    268237 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    269251 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    270265 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    271279 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    272293 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    273307 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    274321 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    275335 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    276349 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    277363 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    278377 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    279391 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    280405 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    281419 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    282433 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    283447 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    284461 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    285475 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    286489 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    287503 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    288517 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    289531 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    290545 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    291560 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    292592 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    293606 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    294620 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    295634 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    296648 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    297662 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    298676 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    299690 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    300704 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    301718 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    302732 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    303746 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    304760 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    305774 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    306788 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    307802 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    308816 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    309830 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    310844 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    311858 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    312872 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    313886 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    314900 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    315914 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    316928 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    317942 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    318956 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    319970 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    320984 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    321998 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    323012 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    324026 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    325040 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    326054 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    327068 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    328082 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    329096 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    330110 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    331134 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    332148 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    333162 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    334176 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    335190 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    336204 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    337218 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    338232 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    339246 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    340260 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    341274 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    342288 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    343302 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    344316 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    345330 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    346344 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    347358 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    348372 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    349386 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    350400 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    351414 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    352428 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    353442 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    354456 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    355470 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    356484 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    357498 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    358512 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    359526 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    360540 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    361554 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    362568 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    363582 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    364596 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    365610 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    366625 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    367639 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    368671 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    369685 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    370699 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    371713 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    372727 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    373741 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    374755 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    375769 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    376783 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    377797 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    378811 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    903 bsp.c:590 Host platform init...success
    5174 bsp.c:604 rak wifi LibVersion:1.0.7.1-2.1.41
    5235 bsp.c:608 rak wifi module-MAC:60:C5:A8:68:BE:2C
    903 bsp.c:590 Host platform init...success
    5174 bsp.c:604 rak wifi LibVersion:1.0.7.1-2.1.41
    5235 bsp.c:608 rak wifi module-MAC:60:C5:A8:68:BE:2C
    903 bsp.c:590 Host platform init...success
    5174 bsp.c:604 rak wifi LibVersion:1.0.7.1-2.1.41
    5235 bsp.c:608 rak wifi module-MAC:60:C5:A8:68:BE:2C
    10912 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    11926 tcp_udp.c:165 RAK_TcpClient sockfd = 1 creat
    19258 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    20270 tcp_udp.c:165 RAK_TcpClient sockfd = 2 creat
    27256 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    28270 tcp_udp.c:165 RAK_TcpClient sockfd = 3 creat
    35267 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    36281 tcp_udp.c:165 RAK_TcpClient sockfd = 4 creat
    43278 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    44292 tcp_udp.c:165 RAK_TcpClient sockfd = 5 creat
    51273 tcp_udp.c:91 RAK_TcpClient函数返回值ret = 4294967282
    52287 tcp_udp.c:165 RAK_TcpClient sockfd = 6 creat

    int RAK_TcpClient(uint16_t destPort, int destIp)
    {
        SOCKADDR_IN     destAddr;
        SOCKADDR_IN     LocalAddr;
        static int      tmp_sockfd = INVAILD_SOCK_FD;
        int             sockfd;
        int             ret;
        int             lPort;
    
    //filling the TCP client socket address
    destAddr.sin_family = AF_INET;
    destAddr.sin_port = htons((uint16_t)destPort);
    destAddr.sin_addr = htonl((int)destIp);
    
    // creating a TCP socket  
    if(tmp_sockfd ==INVAILD_SOCK_FD)
    {
      tmp_sockfd = socket( AF_INET,SOCK_STREAM, 0);
      if (tmp_sockfd < RW_OK)
      {
    			gcUnconnectErrorCmd = 0x01;
    			#ifdef debug
    			DPRINTF("RAK_TcpClient creating a TCP socket failed\n\r");
    			#endif
        return RW_ERR;
      }
    }
    
    srand((int)get_stamp());
    /*port : 1024 - 32768 */
    lPort = (rand() % (32768-1024+1))+ 1024; 
    
    //filling the TCP client local port
    LocalAddr.sin_family = AF_INET;
    LocalAddr.sin_port = htons((uint16_t)lPort);
    LocalAddr.sin_addr = 0;
    
    // binding the TCP socket to the TCP server address
    ret = bind(tmp_sockfd, (SOCKADDR_IN *)&LocalAddr, sizeof(SOCKADDR_IN));
    if (ret == RW_ERR || ret == RW_ERR_TIME_OUT || ret ==RW_ERR_SOCKET_INVAILD)
    {
       close(tmp_sockfd);
       tmp_sockfd = INVAILD_SOCK_FD;
    		 gcUnconnectErrorCmd = 0x02;
    		 #ifdef debug
    		 DPRINTF("RAK_TcpClient binding the TCP socket to the TCP server address failed\n\r");
    		 #endif
       return ret;
    }
    
    // connecting to TCP server
    ret = connect(tmp_sockfd, (SOCKADDR_IN *)&destAddr, sizeof(destAddr));
    if (ret == RW_ERR || ret == RW_ERR_TIME_OUT || ret ==RW_ERR_SOCKET_INVAILD)
    {
      close(tmp_sockfd);
      tmp_sockfd = INVAILD_SOCK_FD;
    		gcUnconnectErrorCmd = 0x03;
    		#ifdef debug
    		DPRINTF("RAK_TcpClient connecting to TCP server failed\n\r");
    		#endif
      return ret;
    }
    
    if (ret == RW_OK) 
    {     
      sockfd = tmp_sockfd ;
      tmp_sockfd = INVAILD_SOCK_FD;
    		gcUnconnectErrorCmd = 0x04;
      return sockfd;
    }
    gcUnconnectErrorCmd = 0x02;
    	#ifdef debug
    	DPRINTF("RAK_TcpClient函数返回值ret = %u \r\n",ret);
    	#endif
    return ret;
    }
    
    void RAK_TcpClient_EventHandle(void)
    {
       int      ret = 0;
    static int      send_recvCnt = 0;
    //        int      temp_len;
      
         uint32_t lIPAddr;
         uint16_t nIPPort;
    
    	if(glDisconnectNetworkTime>2000)
    	{
    		gcDisconnectNetwork = 0x00;
    		app_demo_ctx.tcp_cloud_sockfd = INVAILD_SOCK_FD;
    	}
    	
    if (app_demo_ctx.tcp_cloud_sockfd == INVAILD_SOCK_FD)
    {
    		if((gcCounterSwitch&&glConnectInterval>glIntervalVal)||(!gcCounterSwitch))
    		{
    			gcCounterSwitch = 0x01;
    			glConnectInterval = 0x00;
    			glIntervalVal = 100;
    
    			if(gcNetParamStatus)
    			{
    				gethostbyname((const char *)&gcNetParam[1] ,gcNetParam[0] ,&lIPAddr,AF_INET);
    				nIPPort = 9568;
    			}
    			else
    			{
    				lIPAddr = (unsigned long)(gcWifiParam[65]<<24|gcWifiParam[66]<<16|gcWifiParam[67]<<8|gcWifiParam[68]);
    				nIPPort = (uint16_t)(gcWifiParam[69]<<8|gcWifiParam[70]);	
    			}		
    
    			if((ret =RAK_TcpClient(nIPPort, lIPAddr)) >= 0)
    			{
    				app_demo_ctx.tcp_cloud_sockfd = ret;
    				app_demo_ctx.tcp_cloud_status = STATUS_OK;
    				#ifdef debug
    				DPRINTF("RAK_TcpClient sockfd = %u creat \r\n",app_demo_ctx.tcp_cloud_sockfd);
    				#endif
    				SetTimer(10,200);
    				gnSocketStatusBak = ret;
    				glIntervalVal = 50;
    			}
    			else
    			{
    				gnUnconnectErrorCode = ret;
    				if(ret == RW_ERR || ret==RW_ERR_TIME_OUT) 
    				{ 
    					#ifdef debug
    					DPRINTF("RAK_TcpClient creat failed\r\n");
    					#endif
    				}
    				return;
    			} 
    		}
      else
    		{
    			return;
    		}				
    }
    
     if (app_demo_ctx.tcp_cloud_status <= STATUS_INIT)
    {
       if(app_demo_ctx.tcp_cloud_status < STATUS_INIT)
       {
          close(app_demo_ctx.tcp_cloud_sockfd);
          app_demo_ctx.tcp_cloud_status = STATUS_INIT;
          app_demo_ctx.tcp_cloud_sockfd = INVAILD_SOCK_FD; //close tcp ,for next reconnect.
       }
       return ;
    }
    
    ret = recv(app_demo_ctx.tcp_cloud_sockfd, temp_buf, MAX_RECV_PACKET_LEN, 0);
    if (ret <= 0 )
    {
      if(ret ==RW_ERR_SOCKET_INVAILD){
    //         DPRINTF("recv fd = %u  disconnect \n\r", app_demo_ctx.tcp_cloud_sockfd);
        app_demo_ctx.tcp_cloud_sockfd = INVAILD_SOCK_FD; //close tcp ,for next reconnect.
      }
      
    }else
    {
    //       DPRINTF("recv packets on sockfd=%d  data_len=%d\n\r",          app_demo_ctx.tcp_cloud_sockfd, ret );              
      send_recvCnt += ret;
    		send_recvCnt = send_recvCnt >MAX_RECV_PACKET_LEN ?     MAX_RECV_PACKET_LEN:send_recvCnt;
    		
    		memcpy(gcClientSBuf,&temp_buf[5],(send_recvCnt-0x05));
    		if(gcClientSBuf[send_recvCnt-0x06]==LRC(gcClientSBuf,send_recvCnt-0x06))
    		{
    			gbUserFrameOK2 = TRUE;
    			gnRecvLen1 = send_recvCnt-0x06;
    			
    			memcpy(gcSourcebufferBak,temp_buf,send_recvCnt);
    			gnIpDataRecCnt = send_recvCnt;
    		}
    }		
    	send_recvCnt = 0x00;
    	
    	if(gcTransmitTimes>0x03)
    	{
    		gcTransmitTimes = 0x00;
    		app_demo_ctx.tcp_cloud_sockfd = INVAILD_SOCK_FD;
    	}
    }
    
    int RAK_TcpServer(uint16_t lPort)
    {
    SOCKADDR_IN     LocalAddr;
    static int      tmp_sockfd = INVAILD_SOCK_FD;    
    int             sockfd;
    int             ret;
    
    //filling the TCP server socket address
    LocalAddr.sin_family = AF_INET;
    LocalAddr.sin_port = htons((uint16_t)lPort);
    LocalAddr.sin_addr = 0;
    
    // creating a TCP socket
    if(tmp_sockfd == INVAILD_SOCK_FD)
    {
      tmp_sockfd = socket(AF_INET,SOCK_STREAM, 0);
      if (tmp_sockfd < RW_OK )
      {
        return RW_ERR;
      }
    }
    // binding the TCP socket to the TCP server address
    ret = bind(tmp_sockfd, (SOCKADDR_IN *)&LocalAddr, sizeof(SOCKADDR_IN));
    if (ret == RW_ERR || ret == RW_ERR_TIME_OUT || ret ==RW_ERR_SOCKET_INVAILD)
    {
      close(sockfd);
      return ret;
    }
    
    // putting the socket for listening to the incoming TCP connection
    ret = listen(tmp_sockfd, 1);
    if (ret == RW_ERR || ret == RW_ERR_TIME_OUT || ret ==RW_ERR_SOCKET_INVAILD)
    {
      close(tmp_sockfd);
      return ret;
    }
    
    if (ret == RW_OK) 
    {
      sockfd = tmp_sockfd;
      tmp_sockfd = INVAILD_SOCK_FD;
      return sockfd;
    }
    
    return ret;
    }
    

    0_1489120937633_upload-e6b5aede-59e8-483a-b542-48ebe0203f88

    0_1489120959213_upload-f1e1b436-0b42-4a8f-b533-3c6d766c9b4c



  • 0_1489125147259_upload-ea0cc614-241d-4950-8cb9-e0c62021e72c
    你的这个值已经被赋值了,为什么后面还是会继续建立Socket呢?



  • 0_1489126554750_upload-d79b7206-5956-4d52-a321-48ea49ac3cd6
    你这是做什么用的?为什么要这么写?



  • 你这个log信息我没有看到有断网的迹象?只看到可能是有复位。你在哪里断网的?



  • @xc.c 903 bsp.c:590 Host platform init...success
    5174 bsp.c:603 rak wifi LibVersion:1.0.7.1-2.1.41
    5235 bsp.c:606 rak wifi module-MAC:60:C5:A8:68:83:37
    9969 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    10979 tcp_udp.c:163 RAK_TcpClient sockfd = 1 creat
    25895 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    26909 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    27921 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    28937 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    29042 tcp_udp.c:174 RAK_TcpClient creat failed
    29949 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    30961 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    31977 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    32082 tcp_udp.c:174 RAK_TcpClient creat failed
    32989 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    34001 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    35033 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    35138 tcp_udp.c:174 RAK_TcpClient creat failed
    36050 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    37061 tcp_udp.c:163 RAK_TcpClient sockfd = 1 creat
    99099 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    100112 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    101124 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    102140 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    102246 tcp_udp.c:174 RAK_TcpClient creat failed
    103154 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    104167 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    105184 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    105290 tcp_udp.c:174 RAK_TcpClient creat failed
    106199 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    107212 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    108229 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    108335 tcp_udp.c:174 RAK_TcpClient creat failed
    109244 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    110257 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    111274 tcp_udp.c:63 RAK_TcpClient binding the TCP socket to the TCP server address failed
    111380 tcp_udp.c:174 RAK_TcpClient creat failed
    112289 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    113302 tcp_udp.c:163 RAK_TcpClient sockfd = 1 creat
    158851 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    159864 tcp_udp.c:163 RAK_TcpClient sockfd = 2 creat
    165047 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    166061 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    167075 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    168089 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    169103 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    170117 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    171131 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    172145 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    173178 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    174192 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    175206 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    176220 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    177234 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    178248 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    179262 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    180276 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    181290 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    182304 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    183318 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    184332 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    185346 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    186360 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    187374 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    188388 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    189402 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    190416 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    191430 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    192444 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    193458 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    194472 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    195486 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    196500 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    197514 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    198528 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    199542 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    200556 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    201570 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    202584 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    203598 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    204612 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    205626 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    206640 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    207654 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    208668 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    209682 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    210707 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    211721 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    212735 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    213749 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    214763 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    215777 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    216791 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    217805 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    218819 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    219833 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    220847 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    221861 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    222875 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    223889 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    224903 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    225917 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    226931 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    227945 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    228959 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    229973 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    230987 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    232001 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    233015 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    234029 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    235043 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    236057 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    237071 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    238085 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    239099 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    240113 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    241127 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    242141 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    243155 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    244169 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    245183 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    246197 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    247211 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    248244 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    249258 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    250272 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    251286 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    252300 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    253314 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    254328 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    255342 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    256356 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    257370 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    258384 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    259398 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    260412 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    261426 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    262440 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    263454 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    264468 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    265466 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    266480 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    267494 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    268508 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    269522 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    270536 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    271550 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    272564 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    273578 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    274592 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    275606 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    276620 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    277634 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    278648 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    279662 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    280676 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    281690 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    282704 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    283718 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    284732 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    285730 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    286755 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    287769 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    288783 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    289797 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    290811 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    291825 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    292839 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    293853 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    294867 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    295881 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    296895 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    297909 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    298923 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    299938 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    300952 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    301966 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    302980 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    303994 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    305008 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    306006 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    307020 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    308034 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    309048 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    310062 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    311076 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    312090 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    313104 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    314118 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    315132 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    316146 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    317160 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    318174 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    319188 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    320202 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    321216 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    322230 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    323244 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    324258 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2
    325291 tcp_udp.c:88 RAK_TcpClient函数返回值ret = fffffff2



  • @xc.c 20S内,没有从服务端收到应答数据,就断网。



  • RAK_TcpClient函数返回值ret = fffffff2 这是表示命令正在执行中,这是正常的。
    0_1489131697820_upload-50528b1e-0b50-4951-bcf6-9528eef60450
    你指的断网?是断Socket吧。那你要把Socket close掉的



  • @xc.c close(app_demo_ctx.tcp_cloud_sockfd);添加一行这个代码?


登录后回复
 

与 RAK支持中心 的连接断开,我们正在尝试重连,请耐心等待