You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
963 B
46 lines
963 B
/*
|
|
|
|
Multi-connection Echo Server demonstration.
|
|
|
|
This demonstration currently only runs each server once.
|
|
|
|
*/
|
|
|
|
#include "libw5100.h"
|
|
|
|
#include "echo_server.h"
|
|
|
|
void setup() {
|
|
/*
|
|
Setup function required by Arduino
|
|
*/
|
|
|
|
// Configure the network device
|
|
SpiConfiguration SPI = SpiConfiguration();
|
|
SPI.begin();
|
|
W5100Device W5100 = W5100Device(PIN_RESET);
|
|
NetworkInterface Network = NetworkInterface(W5100);
|
|
|
|
// You need to customise these to your own environment
|
|
Network.device.setIp(210,55,77,111);
|
|
Network.device.setMask(255,255,255,128);
|
|
Network.device.setGateway(210,55,77,1);
|
|
|
|
// This uses the 1-argument constructor of EchoServer and supplies it with 7 for each instance.
|
|
EchoServer servers[MAX_SOCK_NUM] = {7, 7, 7, 7}; // This will break if MAX_SOCK_NUM changes.
|
|
|
|
while (1) {
|
|
for (int i=0; i<MAX_SOCK_NUM; i++) {
|
|
servers[i].next();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void loop() {
|
|
/*
|
|
Loop function required by Arduino
|
|
*/
|
|
}
|