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.

Making board to calulate with ethernet

Good day to you again. The last thing i'm trying to do with my tmdsevm6670l is making on-board calculation. So, if i'm right, i must do the further algorhytm:

  1. Boot the board with ethernet boot mode;
  2. Use the program (changed "client" project in my case) to initialize the DHCP server and make the board to "answer" to ping;
  3. This programm also must hold 2 ethernet buffers: for receiving data from PC and for sending it back to it (i can't load another, because of memory config, i don't know why this is happening, but this is really sad thing);
  4. I have to send the packets with data for calculation for the bufer with specific memory range, board must read this data, calculate it, write to the send buffer and then send it back.

I've searched in NDK documents and found the information about sockets, but i did not quite understand the mechanism of their creation. Also, how do I set a specific address for those buffers? And also, maybe i did not even need socket connection? 

With best regard, Taras.

  • Hi Taras,
    You need to implement an application which will,
    1. Acknowledge the DHCP request.
    2. Should hold 2 buffer for transmit(TX_BUFF) and receive(RX_BUFF) respectively.
    3. Thread will read the received data from RX_BUFF , process and write back to TX_BUFF and transmit.

    Is my understanding correct.
  • Hello Raja.

    Particullary yes. I'm already able to acknowledge the DHCP request, send the compiled .eth programm, which will be executed on board. Now the problem is wtih those 2 buffers and further development
  • I know, that in NDK "sendto" and "recvfrom" are declarated, but i didn't find any example of the use of these functions. Can you link any of them?
  • Hi Taras,
    You can get the example of "sendto" and "recvfrom" from "helloworld" NDK example code.

    udpHello.c

    Ex:
    for(;;)
    {
    tmp = sizeof( sin1 );
    i = (int)recvncfrom( s, (void **)&pBuf, 0, (PSA)&sin1, &tmp, &hBuffer );

    // Spit any data back out
    if( i >= 0 )
    {
    sendto( s, pBuf, i, 0, (PSA)&sin1, sizeof(sin1) );
    recvncfree( hBuffer );
    }
    else
    break;
    }
  • Ok, thank you, that explains a bit. But still, even in this example, i can't fine the string, there socket is created and declared. Referring to manual, it's gotta be like:

    socket(AF_INET, SOCK_STREAM, 0);

    to create. Then i should listen to the socket, and only after that i could initiate the receive process?

    It's really different from the simple "winsock"  creation mechanism and  it does not work as usual, so i'm really confused. 

    Or... is this a so-called "linux demon", that initiates socket with " DaemonNew" function?

  • Also, can i use the defined port №7 for data transmission, or i should choose another?