TCPClientCreate problem


#1

Hello!

Fastrack Supreme 20, FSU002, R7.42, WIP 5.30.0.2040,Open AT OS Package 6.32.0.03

When application call wip_TCPClientCreate( “83.234.195.222”, 5101, evh, NULL), the modem reboots, why?

static void evh( wip_event_t *ev, void *ctx);
void SetGprs (void );

void appli_entry_point() {
  wip_channel_t socket;
   socket = wip_TCPClientCreate( "83.234.197.228", 5101, evh, NULL);
  if( ! socket) {adl_atSendResponse (ADL_AT_UNS, "[SAMPLE] Can't connect\n"); return; }
}

static void evh( wip_event_t *ev, void *ctx) {

  adl_atSendResponse (ADL_AT_UNS, "\n evh \n");

  switch( ev->kind) {

  case WIP_CEV_OPEN: {
    break;
  }
  case WIP_CEV_READ: {
    break;
  }
  case WIP_CEV_WRITE: {
    break;
  }
  case WIP_CEV_ERROR: {
    break;
  }
  case WIP_CEV_PEER_CLOSE: {
    break;
  }
  }
}

void BearerHandler(wip_bearer_t *Br,s8 Event, void * Context) {
	TRACE (( IP_TRACE_LEVEL, "Inside BearerHandler" ));
	switch(Event)
	{
	case WIP_BEV_CONN_FAILED:
	case WIP_BEV_STOPPED:
	case WIP_BEV_IP_DISCONNECTED:
        TRACE (( IP_TRACE_LEVEL, "Bearer Failed" ));
        GprsbConnected = FALSE;
        TcpStopConnection();
        GprsStopConnection();
		break;

	case WIP_BEV_IP_CONNECTED:
	    adl_atSendResponse (ADL_AT_UNS, "\r\nBearer Connect\r\n");

		GprsbConnected = TRUE;
		adl_tmrSubscribe (FALSE, 50, ADL_TMR_TYPE_100MS, appli_entry_point);
		break;
	}
}

void GprsStopConnection(void)
{
  wip_bearerClose(Br_Id);

  wip_netExit();

  adl_tmrSubscribe(FALSE,50,ADL_TMR_TYPE_100MS,SetGprs);
}


bool GprsStartConnection(adl_atResponse_t *Rsp)
{
  s8 sRet=0;

  if(Rsp->RspID != ADL_STR_OK)
  {
	    GprsStopConnection();
	    return GPRS_ERR_CONN_START_FAILED;
  }
  sRet = wip_netInit();

  sRet |= wip_bearerOpen(&Br_Id,"GPRS",BearerHandler,NULL);
  TRACE((1, "wip_bearerOpen: %d", sRet));

  sRet |= wip_bearerSetOpts(Br_Id, WIP_BOPT_GPRS_APN,APN_Details.APN_Name,
							  WIP_BOPT_LOGIN, APN_Details.Username,
							  WIP_BOPT_PASSWORD, APN_Details.Password,
							  WIP_BOPT_END);

  TRACE((1, "wip_bearerSetOpts: %d", sRet));

  if (sRet)
  {
    GprsStopConnection();
    return GPRS_ERR_CONN_START_FAILED;
  }

  sRet = wip_bearerStart ( Br_Id );

  TRACE((1, "wip_bearerStart: %d", sRet));

  if (sRet == WIP_BERR_OK_INPROGRESS)
  {
    return OK;
  }
  if (sRet != OK)
  {
    GprsStopConnection();
    return GPRS_ERR_CONN_START_FAILED;
  }

  return TRUE;
}

void SetGprs (void ) {
	adl_atCmdCreate(GPRS_ATTACH_CMD,FALSE, GprsStartConnection,"*",NULL);
}

but all work on Fastrack Supreme 20, FSU002, 6.63d,WIP 3.10… Open AT OS Package 4.24
Sorry all right,All works, the problem was with wm_apmCustomStack initialization.
The post can be removed

Thanks!