Go Down

Topic: Ethernet and UDP, correct connection practice (Read 226 times) previous topic - next topic

doug metzler

Hello, On an Arduino Ethernet I've got a remote sensor app that connects to the internet once a day to get the time from a time server, then once a week posts the sensor readings.

My question is about correct connection practices and, unfortunately, I don't know that much about the inner workings of network transport.

So all the sample code I've found puts these two lines:

Code: [Select]

...
  if (Ethernet.begin(mac))
  {
    if (Udp.begin(localPort))
...


in the setup and then makes the various network calls in the loop.  But I think that assumes constant use of the connection.  My use of the connection is once a week and, after a few days, my connections fail.

Ideally I'd like to have an Ethernet.end and a Udp.end so I can put the .begin and .end in the loop at the time I want to make the connection, but those calls aren't available.

Can you please tell me what the proper method is to make a connection once a day and ensure that the connection does not fail?

I can post more code here if you'd like.

Thank you,

DougM



Go Up