Skip to content

Commit 608ac87

Browse files
committed
Make changes for UDP echo server in order to be able to serf as iperf echo server.
1 parent 6674f81 commit 608ac87

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

Diff for: examples/UDP_Server/UDP_Server.ino

+19-19
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static IPAddress const gateway {192, 168, 42, 100};
3232
static T1SPlcaSettings const t1s_plca_settings{T1S_PLCA_NODE_ID};
3333
static T1SMacSettings const t1s_default_mac_settings;
3434

35-
static uint16_t const UDP_SERVER_LOCAL_PORT = 8888;
35+
static uint16_t const UDP_SERVER_LOCAL_PORT = 5001;
3636

3737
/**************************************************************************************
3838
* GLOBAL VARIABLES
@@ -114,12 +114,12 @@ void loop()
114114

115115
auto const now = millis();
116116

117-
if ((now - prev_beacon_check) > 1000)
118-
{
119-
prev_beacon_check = now;
120-
if (!tc6_inst->getPlcaStatus(OnPlcaStatus))
121-
Serial.println("getPlcaStatus(...) failed");
122-
}
117+
// if ((now - prev_beacon_check) > 1000)
118+
// {
119+
// prev_beacon_check = now;
120+
// if (!tc6_inst->getPlcaStatus(OnPlcaStatus))
121+
// Serial.println("getPlcaStatus(...) failed");
122+
// }
123123

124124
/* Check for incoming UDP packets. */
125125
int const rx_packet_size = udp_server.parsePacket();
@@ -130,15 +130,15 @@ void loop()
130130
uint16_t const destination_port = udp_server.remotePort();
131131

132132
/* Print some metadata from received UDP packet. */
133-
Serial.print("[");
134-
Serial.print(millis());
135-
Serial.print("] Received ");
136-
Serial.print(rx_packet_size);
137-
Serial.print(" bytes from ");
138-
Serial.print(udp_server.remoteIP());
139-
Serial.print(" port ");
140-
Serial.print(udp_server.remotePort());
141-
Serial.print(", data = \"");
133+
// Serial.print("[");
134+
// Serial.print(millis());
135+
// Serial.print("] Received ");
136+
// Serial.print(rx_packet_size);
137+
// Serial.print(" bytes from ");
138+
// Serial.print(udp_server.remoteIP());
139+
// Serial.print(" port ");
140+
// Serial.print(udp_server.remotePort());
141+
// Serial.print(", data = \"");
142142

143143
/* Read from received UDP packet. */
144144
size_t const UDP_RX_MSG_BUF_SIZE = 16 + 1; /* Reserve the last byte for the '\0' termination. */
@@ -151,18 +151,18 @@ void loop()
151151

152152
/* Print received data to Serial. */
153153
udp_rx_msg_buf[bytes_read] = '\0'; /* Terminate buffer so that we can print it as a C-string. */
154-
Serial.print(reinterpret_cast<char *>(udp_rx_msg_buf));
154+
// Serial.print(reinterpret_cast<char *>(udp_rx_msg_buf));
155155

156156
/* Continue reading. */
157157
bytes_read = udp_server.read(udp_rx_msg_buf, UDP_RX_MSG_BUF_SIZE - 1);
158158
}
159-
Serial.println("\"");
159+
// Serial.println("\"");
160160

161161
/* Finish reading the current packet. */
162162
udp_server.flush();
163163

164164
/* Send back a reply, to the IP address and port we got the packet from. */
165-
udp_server.beginPacket(destination_ip, destination_port);
165+
udp_server.beginPacket(destination_ip, 5001);
166166
udp_server.write(udp_tx_buf.data(), udp_tx_buf.size());
167167
udp_server.endPacket();
168168
}

Diff for: extras/evb-lan8670-usb-linux-6.1.21/load.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
enable=1
4-
node_id=0
4+
node_id=4
55
node_count=8
66
max_bc=0
77
burst_timer=128

0 commit comments

Comments
 (0)