Go Down

Topic: Error in ethernet library UDP doc (Read 3172 times) previous topic - next topic


There is an error in the ethernet library UDP section. The UDP.begin(localPort) call documentation shows there is no return value. That is not correct.

The UDP.begin(localPort) call returns 1 on success, and 0 if no socket is available.

This is from EthernetUdp.h
Code: [Select]
  virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use

and this from EthernetUdp.cpp
Code: [Select]
/* Start EthernetUDP socket, listening at local port PORT */
uint8_t EthernetUDP::begin(uint16_t port) {
  if (_sock != MAX_SOCK_NUM)
    return 0;

  for (int i = 0; i < MAX_SOCK_NUM; i++) {
    uint8_t s = W5100.readSnSR(i);
    if (s == SnSR::CLOSED || s == SnSR::FIN_WAIT) {
      _sock = i;

  if (_sock == MAX_SOCK_NUM)
    return 0;

  _port = port;
  _remaining = 0;
  socket(_sock, SnMR::UDP, _port, 0);

  return 1;

An error report was sent to webmaster@arduino.cc also.


These reference changes take a while now. After the webmaster reads the request, it is posted on github for review.
Still no change to the ethernet udp reference page.


Still no change to the ethernet udp reference page.

Corrections have to be reviewed and validated, cannot be applied "as is". This is the reason for which sometime those stay pending for a while.

The issue in object has been fixed.


Thanks to MadBob for getting that error changed!  :)

I know there is a procedure you must go through, but it seems to take a long time for error corrections that are obvious once the change request gets to Github. This was Arduino library code with an obvious error and solution.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131