Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Ethernet.h>
- byte mac[] = {0xE8, 0x2A, 0xEA, 0x4B, 0x1F, 0xC3};
- IPAddress ip(192, 168, 0, 177);
- unsigned int port = 50001;
- String stringIn;
- EthernetServer server(port);
- void setup() {
- Ethernet.begin(mac, ip);
- server.begin();
- Serial.begin(9600);
- }
- void loop() {
- // if an incoming client connects, there will be bytes available to read:
- EthernetClient client = server.available();
- if (client.connected()) {
- stringIn = "";
- while (client.available()) {
- char c = client.read();
- stringIn = stringIn + c;
- }
- if (stringIn == "Test")
- {
- client.print("Message received");
- }
- Serial.println (stringIn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement