Forum Discussion

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

Talking with Nios Socket Server from a host

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.

4 Replies

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

    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?

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

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.

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

    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 :-(