RTCS_geterror()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTCS_geterror()

Jump to solution
1,262 Views
Swapnil_Enable
Contributor III

I am working on a simple TCP server where multiple client will connect to it. The requirement was server will have multiple port and on each port we will connect the client. so a dedicated connection will be establish.

Now the code i have written works fine. but when

/* Create a task to look after it */  

   if (RTCS_detachsock(child_sock) == RTCS_OK)

   {

  result = _task_create(0, SERVER_C_TASK_0, child_sock);

  if (result == MQX_NULL_TASK_ID)

  {

    RTCS_attachsock(child_sock);

    shutdown(child_sock, FLAG_CLOSE_TX);

    printf("\nCould not create server child task.\n\r");

  }

   }

   else

   {

  printf("\n accept() failed, error 0x%lx", RTCS_geterror(child_sock));

   }

on excecution of the underline statement. i see output on terminal:

I'm waiting for connections ...

Error, accept() failed with error code 1704

Error, getpeername() failed with error code 1704

Client 0 is already connected.

now i am not able to decode the error code 1704.

like what exactly it meant. and what action should i take to avoid it.

Labels (1)
0 Kudos
Reply
1 Solution
783 Views
Swapnil_Enable
Contributor III

thanks Martin, this information is very useful....thanks again...

:smileyhappy:

View solution in original post

0 Kudos
Reply
3 Replies
783 Views
Martin_
NXP Employee
NXP Employee

Hi,

RTCS related error codes are defined in rtcs.h

c:\Freescale\Freescale_MQX_4_0\rtcs\source\include\rtcs.h

RTCS_ERROR_BASE is defined in mqx.h 0x1000

c:\Freescale\Freescale_MQX_4_0\mqx\source\include\mqx.h

so in rtcs.h, for 0x1704 = RTCS_ERROR_BASE | 0x704 = RTCSERR_SOCK_INVALID

Seems the child_sock is not valid.

0 Kudos
Reply
784 Views
Swapnil_Enable
Contributor III

thanks Martin, this information is very useful....thanks again...

:smileyhappy:

0 Kudos
Reply
783 Views
Swapnil_Enable
Contributor III

With the error decoding, i figure out that the sockets i initialized while initializing the network was lower than what i was using....increasing the socket has solved the problem.

0 Kudos
Reply