Wiznet makers

scarlet

Published March 31, 2023 ©

100 UCC

12 WCC

22 VAR

0 Contests

0 Followers

0 Following

Original Link

W5300-TOE Arduino Chat server

W5300-TOE Arduino Chat server

COMPONENTS Hardware components

WIZnet - W5300-TOE-Shield

x 1


PROJECT DESCRIPTION

How to Test AdvancedChatServer Example

This is a simple chat server program that can be run on an STM32 Nucleo-144 board with an W5300-TOE shield. The program listens for incoming client connections and allows them to exchange messages with each other.

Step 1: Prepare software

The following serial terminal programs are required for AdvancedChatServer example test, download and install from below links.

Step 2: Prepare hardware

Combine W5300-TOE Shield with STM32 Nucleo-144 board.

Connect ethernet cable to W5300 TOE Shield ethernet port.

Connect STM32 Nucleo-144 board to desktop or laptop using 5 pin micro USB cable.

Step 3: Setup Advanced Chat Server Example

* Please refer to the following [Getting Start] page for instructions on configuring the Arduino IDE

https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/documents/getting_started.md 

To test the AdvancedChatServer example, minor settings shall be done in code.

  1. Setup network configuration.

Setup network configuration such as IP in 'AdvancedChatServer.ino' in 'Ethernet/examples/AdvancedChatServer' directory.

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 11, 111);
IPAddress myDns(192, 168, 11, 1);
IPAddress gateway(192, 168, 11, 1);
IPAddress subnet(255, 255, 255, 0);
  1. Setup Chat Server configuration.

Setup Advanced Chat server port number in 'AdvancedChatServer.ino' in 'Ethernet/examples/AdvancedChatServer' directory.

#define SERVER_PORT 5000

and And set the maximum number of connected clients.

#define MAX_CLIENT  8

Step 4: Build and Download

After completing the Advanced Chat Server example configuration, build in the IDE you are using.

When the build is completed, download the firmware to the STM32 Nucleo-144 board.

Step 5: Run

  1. Connect to the serial COM port of STM32 Nucleo-144 board with Tera Term.

  1. If the AdvancedChatServer example works normally on STM32 Nucleo-144 board, you can see the network information of STM32 Nucleo-144 board and the chat server is open.

  1. Connect to the open chat server using Hercules TCP client. When connecting to the chat server, you need to enter is the IP that was configured in Step 3, the port is 5000 by default.

When a new client connects, the program sends a welcome message and stores the client's connection in an array.

When a client sends a message, the program broadcasts the message to all connected clients, except the one that sent the message.

Documents
Comments Write