Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

UDP Socket in Niche Stack

Hi

Can Any one Help me plz in Niche stack.I want to know that how can we create a udp socket in Nichestack and send data or listen this socket to receive data.

Its Urgent..................... PLZ

Regards

Hasil86

16 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hi Hasil,

    I've got a DE2-115 and trying to get an ethernet connection to the PC, which i'm strucggling with. DO you know a good place to learn from or do you have working code that i can disect so I may teach myself?

    --- Quote End ---

    You have to read file: DE2_115_Web_Server demonstration project to start learning the communication.But first you have a sound knowledge of BSD Sockets API.

    Feel free to contact for queries....

    Regards

    Hasil86
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Can someone please help me in writing a program for server and client on nios II EDS using Nichestack TCP/IP. I want to communicate between two pc's using a altera startix board on one computer by an ethernet cable.Nios II eds has "simple socket server" example provided by altera. modifying that i want to create my own program which will enable me to transfer data from one pc which will act as server and another pc which will act as client.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    First off, you don't want to use "simple" socket server to start learning about sockets. It (along with most/all of the other provided examples) make use of asynchronous sockets. While not too difficult to understand, they are more complex (and efficient) than what is necessary to setup a simple communications/data transfer medium.

    I like W. Richard Stevens' classic "unix network programming (http://www.kohala.com/start/unp.html)" (the first edition). The source code at the link should be enough to get you going...it worked for me... The tftp server/client was particular useful.

    Cheers,

    slacker
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Sir,

    I did manage to send UDP packet with DM9000A PHY/MAC using Altera DE2 board.

    Since i am using window, i am using the winsock program instead of bsd to receive the udp packet as show in the link below:

    http://www.codeproject.com/kb/ip/udptime.aspx

    But the code hang at the code line below:

    recvfrom(sd, (char *)&current_time,

    (int)sizeof(current_time), 0,

    (struct sockaddr *)&server,

    &server_length) < 0)

    Anybody have experience using winsock here? Please give me some help.

    Thanks.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    OOOH Yes ..................

    I have done it...............

    Yah000000000000000000000

    Thanks slacker

    --- Quote End ---

    hi,hasil86

    It's hard for me to use Niche stack.Can you help me?

    thank you very much!!