Tcp/ip problem


hi all:

 my code can connect TCP/IP in TMT,but my code is download in MODULE ,module can't connect TCP/IP?  WHY?




honestly, did you think somebody really can answer this question?

My best guess is that it is a timing problem, or a memory violation.

Would you mind sharing the code with us? Which compiler did you use, and what module are you using? Also, which core firmware and OpenAT version??

Best Regards,


You question is like saying, “My car won’t start - WHY?”
I’m sure you wouldn’t expect anybody who hasn’t even seen you car to be able to answer that without a whole lot more information! :unamused:

You need to describe exactly what does and does not happen - does the code run at all? how far does it get towards connecting? at what point does it fail? what error codes/results do you get? what debugging have you done yourself on this? Have you used TRACE to follow its progress?
etc, etc, etc,…


my code:

void tcp_start(void)
s8 sReturn = ERROR;
ready_to_send = TRUE;
/// ed_Init();///////////////////////////////////////////////////////////////
sReturn=ed_SocketTCPStart ( ED_ID_TCPSOCKET_1, 0,tcp_pfResponseCbk, tcp_pfDataHnd, tcp_pfDataRequest);
if(sReturn == 0)
else if(sReturn==ED_ERR_NOT_INIT)
//tcptimerHandle = adl_tmrSubscribe(FALSE, 10, ADL_TMR_TYPE_100MS,(adl_tmrHandler_t)tcptimerHandler);
else if(sReturn==ED_ERR_INVALID_ARG) cmd_rsp_sig(10);
else if(sReturn==ED_ERR_STACK_BAD_CONFIG) cmd_rsp_sig(12);//////////////////////////////////////
else if(sReturn== ED_ERR_PHY_NOT_ACTIVATED)
else if(sReturn==ED_ERR_STACK_BUSY) cmd_rsp_sig(13);//////////////////////////////////////
else if(sReturn==ED_ERR_INVALID_ID) cmd_rsp_sig(62);//////////////////////////////////////
else if(sReturn==ED_ERR_MEMALLOC_FAILED) cmd_rsp_sig(64);//////////////////////////////////////
else if(sReturn==ED_ERR_SOCKET_CREATION_BUSY) cmd_rsp_sig(65);//////////////////////////////////////
else cmd_rsp_sig(66);//////////////
TRACE (( 4, " ed_SocketTCPStart: %d", sReturn ));
// ready_to_send = TRUE;


void tcp_udp_connection(void)
s8 sReturn = ERROR;
tcp_udp_type =1;
// ed_Init();
// ed_Init();/////////////////////////////////////////
if(tcp_udp_type == TCP_TYPE)//tcp
my_tcpParams.TcpPort= (u16)(my_distantip[0] + (my_distantip[1]<<8));
//my_tcpParams.TcpPort =10089;
TRACE (( 4, " ed_SocketGetConfig: %d",my_tcpParams.TcpPort));
wm_sprintf (my_tcpParams.TcpServ, “%d.%d.%d.%d”,my_distantip[5],my_distantip[4],my_distantip[3],my_distantip[2]);
// wm_sprintf (my_tcpParams.TcpServ, “%d.%d.%d.%d”,dis[3],dis[2],dis[1],dis[0]);
// wm_sprintf (my_tcpParams.TcpServ, “”);
sReturn = ed_SocketSetConfig ( ED_ID_TCPSOCKET_1, &my_tcpParams );

    else if(sReturn==ED_ERR_NOT_INIT)
		tcptimerHandle = adl_tmrSubscribe(FALSE, 10, ADL_TMR_TYPE_100MS,(adl_tmrHandler_t)tcptimerHandler);
    else if(sReturn==ED_ERR_INVALID_ARG)	 cmd_rsp_sig(7);//////////////////////////////////////
   	else if(sReturn==ED_ERR_PARAM_BAD_VALUE) cmd_rsp_sig(50);//////////////////////////////////////
    else if(sReturn==ED_ERR_PARAM_TOO_LONG)	 cmd_rsp_sig(60);//////////////////////////////////////
	else if(sReturn==ED_ERR_PARAM_WRITE_E2P)	 cmd_rsp_sig(70);//////////////////////////////////////
    else if(sReturn==ED_ERR_SERVICE_ALREADY_RUNNING)	 cmd_rsp_sig(80);//////////////////////////////////////
    else 	 cmd_rsp_sig(90);//////////////////////////////////////
    my_udpParams.UdpPort= (u16)(my_distantip[0] + (my_distantip[1]<<8));
	wm_sprintf (my_udpParams.UdpServ, "%d.%d.%d.%d",my_distantip[5],my_distantip[4],my_distantip[3],my_distantip[2]);
	sReturn = ed_UdpSocketSetConfig ( &my_udpParams );
	//TRACE (( 5, " ed_SocketGetConfig: %d", sReturn ));
		udptimerHandle = adl_tmrSubscribe(FALSE, 5, ADL_TMR_TYPE_100MS,(adl_tmrHandler_t)udptimerHandler);
	sReturn=ed_SocketUDPStart (0,udp_pfResponseCbk, udp_pfDataHnd, udp_pfDataRequest);
    TRACE (( 4, " ed_SocketTCPStart: %d", sReturn ));
      ready_to_send = TRUE;



my code is downloaded in module,gprs is connected,but socket is not connected;
ed_SocketSetConfig (); return -52;
i write ed_Init() before ed_SocketSetConfig (); return 0
but ed_SocketTCPStart();return -11,why?
please help me,thank you



I think you shouldn’t use “delay_time(3000);”. What does this function do? Block processing for 3 seconds? You are lucky that the module doesn’t do a watchdog reset!

You could do ed_Init() in the SIM handler function on “ADL_SIM_EVENT_FULL_INIT” event. I think that would be a good place.

I think you can do the ed_SocketSetConfig right before you open the connection - that should be OK, but I believe that you must return the control to the operating system after ed_Init(). I don’t think that a delay (which does not give the control flow back to the OS) will work.

You could start a timer after ed_Init() and continue processing when your timer callback is called… That should work!

Best Regards,


I deleted delay_time(3000)and writed to ed_Init() before adl_simSubscribe(SimHandler,PinCode);my code is still so;

I debuged this code last week. I cann’t settle this problem;
I’m very desponding
thank you very much


hi all:

 ed_SocketTCPStart() return ED_ERR_PHY_NOT_ACTIVATED.why?

thank you


hi all:

ed_SocketTCPStart() return ED_ERR_PHY_NOT_ACTIVATED,why?

please help me,thank you


Did you use AT+CGATT=1 or AT+WGPRS=0,0?

Best Regards,


I has already used “AT+CGATT=1”;

thank you,


Did you wait for the “OK” response?


i did wait for “ok” response,

my code
adl_atCmdCreate( “AT+CGATT=1”, TRUE, (adl_atRspHandler_t)gprsAttachHandler, “OK”, NULL );

my code can connect socket in TMT,but my CODE is downloaded
in wavecom module,can’t connect SOCKET,can connect GPRS;
so I think my code is no problem,

thank you!


Hi czbing,

I don’t know what the problem is… But I remember that I had problems with AT+CGATT, too! I suggest you try “AT+WGPRS=0,0” instead…

See: (look for AT+WGPRS=0,0)

Best Regards,