Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial

ID 683574
Date 10/04/2021
Public
Document Table of Contents

1.5.5. Interacting with the Nios II Simple Socket Server

The Nios II Console view displays a message with the default IP address as configured in simple_socket_server.h. If DHCP is enabled, the DHCP server-supplied IP address displays a message that indicates the DHCP client for the Ethernet interface acquires a DHCP IP address.

The message “Nios II Simple Socket Server starting up” displays when the NicheStack TCP/IP Stack is ready to accept commands.

After the NicheStack TCP/IP Stack is ready, you can start a telnet session to interact with the stack. To start a telnet session, follow these steps:

  1. From your operating system, open a command shell.
    Note: On Windows, you can also use Run on the Start menu.
  2. Type the following command, specifying either the static IP address or the DHCP server-provided IP address:
    telnet <IP address> 30

If the connection to port 30 on the development board is successful, the menu of available commands displays in a command window. When you enter commands at the command prompt, Ethernet sends the commands over the telnet connection to a task waiting on a socket for commands. The task responds to those commands by sending instructions to another task that manipulates the LED. Figure 7 shows the Nios II Simple Socket Server menu, along with entered commands 1, 2, 3, and Q.

Figure 7. Interacting with the Nios II Simple Socket Server Via Telnet

Figure 8 shows the corresponding output that appears in the Nios II Console view.

Figure 8. Nios II Console Output During Telnet Session

To test the functionality of the Nios II Simple Socket Server, enter the following commands in the telnet session:

  1. Type <n> , where <n> is a number from one through nine, to change the LED's state on your board.
  2. Repeat step 1 several times, varying the number, to see the LED turn on and off.
  3. Type Q to terminate the test. The socket connection on the development board terminates and the telnet command exits.