Skip to content

Instantly share code, notes, and snippets.

@gibsop1
Created January 20, 2014 20:09
Show Gist options
  • Save gibsop1/ba4cd682913144fecd18 to your computer and use it in GitHub Desktop.
Save gibsop1/ba4cd682913144fecd18 to your computer and use it in GitHub Desktop.
#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