Pages: [1]   Go Down
Author Topic: Error in ethernet library UDP doc  (Read 2726 times)
0 Members and 1 Guest are viewing this topic.
Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 149
Posts: 6117
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  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:
/* 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.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 149
Posts: 6117
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Forum Administrator
Offline Offline
Jr. Member
*****
Karma: 9
Posts: 95
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

BOFH

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 149
Posts: 6117
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks to MadBob for getting that error changed!  smiley

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

Pages: [1]   Go Up
Jump to: