-
-
Save gibsop1/ba4cd682913144fecd18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <UIPEthernet.h> | |
EthernetServer server = EthernetServer(1000); | |
void setup() | |
{ | |
Serial.begin(9600); | |
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x01}; | |
IPAddress myIP(192,168,0,134); | |
Ethernet.begin(mac,myIP); | |
server.begin(); | |
} | |
void loop() | |
{ | |
size_t size; | |
if (EthernetClient client = server.available()) | |
{ | |
while((size = client.available()) > 0) | |
{ | |
uint8_t* msg = (uint8_t*)malloc(size); | |
size = client.read(msg,size); | |
Serial.write(msg,size); | |
free(msg); | |
} | |
client.println("DATA from Server!"); | |
client.stop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment