Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

UDP Socket in Niche Stack

Altera_Forum
Honored Contributor II
1,787 Views

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
0 Kudos
16 Replies
Altera_Forum
Honored Contributor II
385 Views

Unless you're using Superloop Nichestack....the same way you would for any other TCP/IP stack that supports the sockets API standard. 

 

Also, this question has definitely been asked before and I believe there's even a few examples...either here or on alterawiki.com. 

 

Cheers, 

 

slacker
Altera_Forum
Honored Contributor II
385 Views

These Example are so tough for Beginners .........

Altera_Forum
Honored Contributor II
385 Views

You don't have to use asynchronous sockets (which, I admit, are harder to understand). I would start with something like the following: 

 

http://www.abc.se/~m6695/udp.html 

 

There will be small differences to get this functional with Interniche sockets, slightly more with the strangeness that is winsock, but it should work. 

 

Cheers, 

 

slacker
Altera_Forum
Honored Contributor II
385 Views

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

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

Yah000000000000000000000 

Thanks slacker
Altera_Forum
Honored Contributor II
385 Views

hi I am working on UDP Socket between DE2 board and PC. Could you show me how you were done UDP on DE2 board? (I am sending back and forth one character, like chatting)

Altera_Forum
Honored Contributor II
385 Views

on De2 you would have to install uclinux or micro tcp/ip with micro c os2 to create the udp socket.As the de2 board has dm9000 ethernet controller which is not supported by interniche stack. 

i have done it on de2-115 which have triple speed ethernet which is supported by interniche stack.  

 

Regards 

Hasil86
Altera_Forum
Honored Contributor II
385 Views

 

--- Quote Start ---  

on De2 you would have to install uclinux or micro tcp/ip with micro c os2 to create the udp socket.As the de2 board has dm9000 ethernet controller which is not supported by interniche stack. 

i have done it on de2-115 which have triple speed ethernet which is supported by interniche stack.  

 

Regards 

Hasil86 

--- Quote End ---  

 

 

Hi, as you say about triple speed Ethernet, you meant that you selected the Triple Speed Ethernet IP Core under Series Communication in SOPC. Is it right? Does it work as the same chip with DM9000A? Or that is the other chip on specific board? I am using DE2-70 Board, but there is nothing about Triple Speed Ethernet on the Manual Document. 

 

Thank you for your help!
Altera_Forum
Honored Contributor II
385 Views

Triple Speed Ethernet IP doesnt work with dm9000A .It only Works with de2-115 .This is specific to de2-115 . 

The only possible solution for networking using sockets in De2-70  

1.UClinux 

2.Micro C OS2 + Micro C Tcp/ip 

 

But i didnt done both of the solution. 

 

so you have to workout
Altera_Forum
Honored Contributor II
385 Views

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?
Altera_Forum
Honored Contributor II
385 Views

I have done the Ethernet Connection between DE2-70 and PC, I am using DM9000A with UDP socket wrap by manually define Ethernet, IP, and UDP Checksum. On PC side I am running JAVA Programming, you have to do the same on PC side by manually program by RAW socket.  

Here the link with very useful projects, which done Ethernet Connection on DE2 board. 

 

http://www.cs.columbia.edu/~sedwards/classes/2011/4840/index.html (http://www.cs.columbia.edu/~sedwards/classes/2011/4840/index.html)
Altera_Forum
Honored Contributor II
385 Views

 

--- 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
Honored Contributor II
385 Views

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
Honored Contributor II
385 Views

I'm still in the middle of learning, but these are helping me currently: 

 

http://en.wikipedia.org/wiki/bsd_socket Explains sockets and this is what the niche stack is built on. 

 

The link posted by someone in the second post  

http://www.abc.se/~m6695/udp.html 

 

and the book "TCP/IP Sockets in C" by Donahoo and Calvert. 

 

Sorry i can't help more i'm still trying to customise and learn atm.
Altera_Forum
Honored Contributor II
385 Views

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
Honored Contributor II
385 Views

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
Honored Contributor II
385 Views

 

--- 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!!
Reply