ed_SocketTCPStart returning ERR_INVALID_ID


#1

Hi,

I want to sent dome data through a TCP socket.
once everything is initialised (SIM ready, GPRS attached…).
I call :

ed_SocketSetConfig(ED_ID_TCPSOCKET_2, &scannerParams.socket);

then, later I send data :

ed_SendDataExt(Buff,(u16)strlen(Buff),FALSE,ED_ID_TCPSOCKET_2);

if ed_SendDataExt returns -63 (ERR_ID_INACTIVE), I (re)start the TCP Socket :

if (result == ED_ERR_ID_INACTIVE)//-63
{// the service is inactive 
	result = ed_SocketTCPStart(ED_ID_TCPSOCKET_2, 0, SocketRspCbk, SocketDataHnd, SocketDataRequest);
	TRACE((8, "ScannerSocket Started again -> ed_SocketTCPStart :%d ",result));
}

Here, ed_SocketTCPStart returns -62 (ERR_INVALID_ID).
I’m quite astonished to see this error that I don’t understand.

Does anyone know what can cause this error to appear ?

Thanks,

Veranith


#2

Hi Veranith,

It seems that you are calling ed_SendDataExt () function without opening the TCP socket. In other words, your Socket is not opened (ed_SocketTCPStart () has not been called) before calling ed_SendDataExt ().

I hereby dictate the steps that you need to follow:

  1. Attach to GPRS.
  2. Call ed_DialupConnectionStart () and receive the IP.
  3. Set the Socket configuration parameters (using ed_SocketSetConfig).
  4. I hope that you are doing things correctly upto this point.
  5. Call ed_SocketTCPStart () function to start the socket. When you receive ED_INFO_WAITING_FOR_DATA, it means that your socket is now active. Only after receiving this event, you should call ed_SendDataExt () function.
    Also make sure that you call ed_SendDataExt () only after receiving a call to pfRequestCallback_f function (after reading the MaxLen parameter).
    This should solve the problem of ED_ID_INACTIVE.

The problem of ERR_INVALID_ID can be attributed to the fact that sometimes when an Open-AT application is executed in debug mode (which uses the TCP socket), it gives the same error. To solve this problem, please delete the contents of rte/objects folder present in the directory which contains your Open-AT project.

Hope, this solves the problem.
Best Regards,
Open AT Fan.