This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

NDK - tcp connect fails

Hello,

Maybe you can help?

Thanks in advance.

The following is the data:

Board: EVMC6748 (I am using the TMS320C6748 DSP).

I am connected using the ethernet port to my router.

ccs: 5.4.0.00091

bios: 6_35_01_29

pspdrivers: 01_30_01

nsp: nsp_1_10_02_09

ndk: ndk_2_22_03_20

xdctools: 3_25_00_48

xgconf:  I selected "global network settings", "http", "tcp", "ip" and enable IPv6.


I cannot pass the"connect" function.

I verified that I have a laptop connected to the same network and has a tcp server open in the ip and port as I set there.

I tested the server with client program in same computer and it works,

I got error 65 ( EHOSTUNREACH)

My task details:

Task_Params taskParams;
Task_Params_init(&taskParams);
taskParams.stackSize = 512*4;
taskParams.priority = 1;
taskParams.arg0 = NULL;
taskParams.arg1 = NULL;

The part of the task until it tries to connect and fails:


Void tcpTask(UArg a0, UArg a1)
{

SOCKET s;// = INVALID_SOCKET;
struct sockaddr_in sin1;
int i;
char *pBuf = 0;
struct timeval timeout;
Task_sleep(5000);
// Allocate the file descriptor environment for this Task
if (!fdOpenSession( (HANDLE)Task_self() ))
return;
printf("\n== Start TCP Echo Client Test ==\n");
//IPN IPAddr = inet_addr("169.254.247.52");
IPN IPAddr = inet_addr("192.167.1.2");


// Create test socket
// s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
s = socket(AF_INET, SOCK_STREAMNC, IPPROTO_TCP);
if( s == INVALID_SOCKET )
{
printf("failed socket create (%d)\n",fdError());
goto leave;
}
// Prepare address for connect
bzero( &sin1, sizeof(struct sockaddr_in) );
sin1.sin_family = AF_INET;
sin1.sin_len = sizeof( sin1 );
sin1.sin_addr.s_addr = IPAddr;
sin1.sin_port = htons(2222);
// Configure our Tx and Rx timeout to be 5 seconds
timeout.tv_sec = 5;
timeout.tv_usec = 0;
setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof( timeout ) );
setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof( timeout ) );
// Connect socket
if( connect( s, (PSA) &sin1, sizeof(sin1) ) < 0 )
{
printf("failed connect (%d)\n",fdError());
goto leave;
}

Any idea?

Thanks in advance!!!

Gaby