Go Down

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

SurferTim

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.
http://arduino.cc/en/Reference/EthernetUDPBegin

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;
      break;
    }
  }

  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.

SurferTim

These reference changes take a while now. After the webmaster reads the request, it is posted on github for review.
https://github.com/arduino/Arduino/issues/2082
Still no change to the ethernet udp reference page.

MadBob


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.
BOFH

SurferTim

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