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.

UDP example using NDK and SYSBIOS Task.

Other Parts Discussed in Thread: SYSBIOS

Hi there,

I am planning to implement my know UDP client and server on the OMAP L138 LCDK board and I have read the user and design guide for the NDK with the reference design. 

I was able to run the hello world and client example provided with the NSP. however, when I try to make some changes it doesn't seem to work. 

Following changes I made: 

1) like to implement the hello world example using the BSD socket standard and hence followed the steps mentioned in the reference guide, Section 3.3.

    - Removed the reference to NDK/INC and added NDK/INC/BSD in the include path. 

 I get error about the dtask_udp_hello socket type and UINT32 type are not defined.. Which is expected after removing the reference from the NDK/INC ... but I think the socket in BSD format is of type int and I am not sure how can I change the type of the dtask_udp_hello when called in the NewDaemon function. 

2) In the user guide Section 3.3.. creating the task using configuration method.. I have created a task using static method with the stack size 4096 and priority of 5 as mentioned in the guide! 

I have also added the fdOpenSession and fdCloseSession as shown in the example design. When I run the example I get an error stating unable to create socket! that is it return INVALID_SOCKET..

I was under the impression that, if I don't want to use the NewDaemon function to create sockets then I can create task - socket using the 2nd method. 

Could you please explain, how to create a socket in BSD and how to create a socket using the SYSBIOS task. Thanks.

Regards,

Mitesh


  • I was under the impression that, if I don't want to use the NewDaemon function to create sockets then I can create task - socket using the 2nd method.

    Could you please explain, how to create a socket in BSD and how to create a socket using the SYSBIOS task. Thanks.

    Refer to this wiki page.
    processors.wiki.ti.com/.../NDK_Dynamic_Memory_Manager

    Let me check for enabling the BSD socket in NDK helloworld example.

  • I have also added the fdOpenSession and fdCloseSession as shown in the example design. When I run the example I get an error stating unable to create socket! that is it return INVALID_SOCKET..

    As user guide stated that you should not include mixed of NDK include files and BSD include files.
    It should not be used by any of your code.
    C:\ti\ndk_2_24_01_18\packages\ti\ndk\inc

    Refer 3.4.1.1, Error checking conflicts and File separation section.

    Include statement: Most BSD sockets applications should have the following include statement:
    #include <sys/socket.h>
    File separation: In general, a BSD application should contain BSD-style sockets code in a separate C
    file. That is, BSD sockets code should not be mixed with NDK code, such as NDK sockets code or
    standard (non-BSD) NDK APIs. This must be done in order to avoid type and function name conflicts
    between standard NDK headers and BSD layer headers.
    The file containing BSD-style code can include header files found in the ti/ndk/inc/bsd directory tree (for
    example, sys/socket.h) and should not need to include any NDK header file found in ti/ndk/inc and its
    subdirectories other than the /bsd subdirectory.
    A good rule to follow is to organize BSD sockets code into a separate file that includes only BSD style
    header files along with SYS/BIOS and XDC header files as needed. Code that performs NDK-specific
    functionality--for example, NDK network open or close hooks, IPv6 system initialization and deinitialization
    calls--should go a separate file or files that include the standard (non-BSD) NDK header files found within
    ti/ndk/inc.

    Can you please check the "sockaddr_in" this structure and its declaration location ?
    And please make sure that the following locations were not used in BSD style code.
    C:\ti\ndk_2_24_01_18\packages\ti\ndk\inc\bsd\socketndk.h
    C:\ti\ndk_2_24_01_18\packages\ti\ndk\inc\socketndk.h
  • Thanks for your reply. 

    Okay, lets forget about BSD sockets programming for now. I have converted all the code in NDK socket format. 

    I have created a EchoUdp static task in the configuration and have set the priority to 5. And this task is the example shown in the User guide Section 3.4 only change is its UDP rather than TCP. 

    Could you please let me know how is the UDP client socket expected to work on the DSP core. I am get error while creating the socket!

  • Could you please explain, how to create a socket in BSD and how to create a socket using the SYSBIOS task. Thanks.



    Post this query on TI-RTOS forum(link below) for appropriate response. Thank you.

    PS: Please post your compiler related queries to Compiler forum  TI-RTOS (SYS/BIOS) related queries to TI-RTOS Forum and Code Composer Studio related queries to CCS Forum