Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ethernet/UDP libraries loses packets if there are multiple packets in w5100 buffer [imported] #669

Closed
Labels
@cmaglie

Description

This is Issue 669 moved from a Google Code project.
Added by 2011年10月05日T09:14:40.000Z by dy...@deedums.com.
Please review that bug for more context and additional comments, but update this bug.
Closed (Fixed).

Original labels: Type-Defect, Priority-Medium, Component-Core, Milestone-1.0.1

Original description

What steps will reproduce the problem?

  1. Send multiple UDP packets to Arduino board.
  2. Call Udp->readPacket, e.g.

const int max_msg = 20;
byte msg[max_msg];

Udp.readPacket(&msg, max_msg, remoteIp, &remotePort);

If the sum of the UDP packets in the W5100 receive buffer are greater than max_msg then the UDP library interprets this as being a single packet which is too long for your buffer. The UDP library then uses a work-around which reads in the packet up to max_msg discarding any more data in the w5100 receive buffer.

The work-around in the UDP library exists to work-around a bug in the socket.cpp library which doesn't check the length of your buffer before writing data to it.

What version of the Arduino software are you using? On what operating
system? Which Arduino board are you using?

I'm using 0022 on Ubuntu Linux 10.04. I'm using a Freetronics EtherTen (Uno + Ethernet Shield compatible).

Please provide any additional information below.

I've fixed the buffer-over flow bug in socket.cpp which means the work-around in the UDP library can be removed. The upshot is considerably simpler and doesn't lose packets :)

Fixed versions of Udp.cpp and socket.cpp attached.

While trying to figure out how to submit bugs I see IDE version 1.0rc1 is out. The Ethernet/UDP code has the same bug in socket.cpp but it looks like the new UDP library doesn't use the faulty routine. I think the same problem exists in the new library but I'm not 100% sure at this stage. I'll update this bug when I've got my head around the new UDP library and try and supply a fix if necessary.

Thanks,

Dylan Hall

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /