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.

EHOSTUNREACH(No route to host) Problem

Other Parts Discussed in Thread: SYSBIOS

Hello,

I've tried to make udp socket between the C6678 and my laptop using the utp cable.

The dsp is on the channel card and uses mgmt0 ethernet card to connect directly with my labtop.

The connection has no problem with 'ping' test, but in my code, sendto() function returns  'EHOSTUNREACH(No route to host)'.

My code is as below, please let me know what I have to check.

.cfg

 ..

var Global = xdc.useModule('ti.ndk.config.Global');
var GateTask = xdc.useModule('ti.sysbios.gates.GateTask');

Global.networkIPAddrHook = '&myIPAddrHook';

..

.c

static int sock = INVALID_SOCKET;
static struct sockaddr_in ipaddr;

fdOpenSession( TaskSelf() );
sock = socket( AF_INET,  SOCK_DGRAM, IPPROTO_UDP );
bzero( &ipaddr, sizeof(struct sockaddr_in) );
ipaddr.sin_family = AF_INET;
ipaddr.sin_addr.s_addr = inet_addr("***.***.***.***");
//inet_aton("***.***.***.***", &ipaddr.sin_addr);
ipaddr.sin_port = htons(3000);

 

if( sock == INVALID_SOCKET )
    MACPHYConsolePrintf("INVALID SOCKET@@\n");
bind(sock, (PSA)&ipaddr, sizeof(ipaddr));    // return 65(EHOSTUNREACH)
MACPHYConsolePrintf("bind() return value : %d\n", fdError());
TaskSleep(1);
sendto( sock, "test", 8, 0, (PSA)&ipaddr, sizeof(ipaddr) );  // return EHOSTUNREACH(65)
MACPHYConsolePrintf("sendto() return value : %d\n", fdError());

 

fdClose(socket);
TaskBlock(TaskSelf());

  • Dear SangKyu,
    Have you tried our NDK example on your C6678 board ?
    C:\ti\mcsdk_2_01_02_06\examples\ndk\helloWorld\evmc6678l

    Here, we have UDP socket test code.
    C:\ti\mcsdk_2_01_02_06\examples\ndk\helloWorld\udpHello.c

    Can you please try this and update to us ?
  • Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com). Please read all the links below my signature.

    Thank you.

    Note: We strongly recommend you to create new e2e thread for your queries instead of following up on an old/closed e2e thread, new threads gets more attention than old threads and can provide link of old threads or information on the new post for clarity and faster response.

  • Dear Stalin,

    I've executed the sample codes, and it's not worked properly.

    I sent a message in my laptop to DSP, but there's no feedback form echo server.

    There are two ethernet cards on  my channel card, and I think the dsp can't choose proper one.

    Pease let me know how can I figure out this problem.