Hi,
I have tried for sometime now to stream some data from an Arduino Nano with Ethernet Shield, I can successfully send the data once. Using client.print(xxxx) and then client.stop() to send the data.
But how can I Send data without closing the TCP connection to my TCP Server?
#include <UIPEthernet.h>
EthernetClient client;
void setup() {
Serial.begin(9600);
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
Ethernet.begin(mac);
Serial.print("localIP: ");
Serial.println(Ethernet.localIP());
Serial.print("subnetMask: ");
Serial.println(Ethernet.subnetMask());
Serial.print("gatewayIP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("dnsServerIP: ");
Serial.println(Ethernet.dnsServerIP());
delay(1000);
}
void loop()
{
Serial.println("Try to connect to 10.0.0.18");
if (client.connect(IPAddress(10,0,0,18),55056))
{
Serial.println("Connected");
while(client.available()==0)
{
client.print("TEST"); // Data to stream, could be an analog input or something like that.
break;
}
client.stop();
}
else
{
Serial.println("Failed to connect");
delay(1000);
}
}
Thanks in Advance
Ramgaard