Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12604 Discussions

Talking with Nios Socket Server from a host

Altera_Forum
Honored Contributor II
1,307 Views

I am working with Nios II Simple Socket Server sample running it on the Cyclon III board. When connected to the corporate LAN, this program gets dynamic IP address from DHCP and shows it in the console output: 

 

Acquired IP address via DHCP client for interface: et1 

IP address : 10.90.185.214 

Simple Socket Server listening on port 30 

 

Looking at this address, I can start talking with the device from the host: 

 

telnet 10.90.185.214 30 

 

So far, it is OK. However, when such device runs without Nios console, I don't see this dynamic IP. How can I talk with such server from a host program? This question is more about PC programming, but I hope somebody has solution. 

Thanks.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
374 Views

To be more precize: I have two ways to connect to a socket server from host: by IP address or server name. Since the program doesn't know dynamic IP, I need the server name. Does NicheStack TCP/IP Stack allow to set server name?

0 Kudos
Altera_Forum
Honored Contributor II
374 Views

I think you need to set your dhcp server to give that system a fixed IP address (based on it's MAC address). 

You can then setup your DNS server to map the machines name to that IP address. 

The dhcp server can also give the system it's hostname - but that is for internal use only, and may be ignored by the NicheStack code.
0 Kudos
Altera_Forum
Honored Contributor II
374 Views

Thanks. Since I don't want to change anything in a network, I prefer for now to turn off DHCP and continue to work with fixed IP address.

0 Kudos
Altera_Forum
Honored Contributor II
374 Views

Another option is to send out 'talk to me' UDP messages to a broadcast IP address, and have your application wait for one from the correct serial number. 

 

When windows PCs use DHCP they use some microsoft specific protocol to tell the nameserver (the WINS one I think) their name and IP address - this has to be open to network spoofing :-(
0 Kudos
Reply