From a4b52f20b590d535c3e0a6ad147b04256fbac697 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Wed, 7 Jan 2009 21:16:45 +0000 Subject: [PATCH] Originating each outgoing network connection from a different source port (in the Client class of the Ethernet library). Updating readme and todo. --- hardware/libraries/Ethernet/Client.cpp | 6 +++++- hardware/libraries/Ethernet/Client.h | 1 + readme.txt | 3 +++ todo.txt | 13 +++++++++++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hardware/libraries/Ethernet/Client.cpp b/hardware/libraries/Ethernet/Client.cpp index 9d3e0df2139..6c19b8fce16 100644 --- a/hardware/libraries/Ethernet/Client.cpp +++ b/hardware/libraries/Ethernet/Client.cpp @@ -8,6 +8,8 @@ extern "C" { #include "Client.h" #include "Server.h" +uint16_t Client::_srcport = 0; + Client::Client(uint8_t sock) { _sock = sock; } @@ -29,8 +31,10 @@ uint8_t Client::connect() { if (_sock == 255) return 0; + _srcport++; + // XXX: what port should we connect from? - socket(_sock, Sn_MR_TCP, _port, 0); + socket(_sock, Sn_MR_TCP, _port, 1024 + _srcport); if (!::connect(_sock, _ip, _port)) return 0; diff --git a/hardware/libraries/Ethernet/Client.h b/hardware/libraries/Ethernet/Client.h index 5911b956abb..f269e9b93a6 100644 --- a/hardware/libraries/Ethernet/Client.h +++ b/hardware/libraries/Ethernet/Client.h @@ -5,6 +5,7 @@ class Client : public Print { private: + static uint16_t _srcport; uint8_t _sock; uint8_t *_ip; uint16_t _port; diff --git a/readme.txt b/readme.txt index 0e3abe9a9c7..2cc9f3ca0b5 100644 --- a/readme.txt +++ b/readme.txt @@ -65,7 +65,10 @@ UPDATES any pulse that had already started when the function was called). * Fixing bug in random() that limited the ranges of values generated. Thanks to Mikal Hart. +* Modifying delay() to pause for at least the given number of milliseconds. * Fixing bug in Ethernet library that interfered with use of pins 8 and 9. +* Originating each outgoing network connection from a different port (in the + Client class of the Ethernet library). Thanks to Paul and joquer. * Modifying the core, libraries, and bootloader source to support the ATmega328, but not yet including it in boards menu. * Updating ATmega168 bootloader to work with standard distributions of avrdude diff --git a/todo.txt b/todo.txt index c96c031f7a8..fbb49af81e9 100644 --- a/todo.txt +++ b/todo.txt @@ -1,13 +1,12 @@ 0013 arduino -Fix TICR0 for ATmega8. -Fix delay() comparison to use <= not <. Ethernet library should use a different source port for each outgoing Client connection: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1227978344 Support atmega328: http://spiffie.org/know/arduino_328/ - add atmega328 to avrdude.conf (on Windows) AVR +Make Client::_srcport static? http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1227735530 Allow hardcoding of R/W line to ground with LiquidCrystal library. Improve shiftOut() performance: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1216659239/0 Add String library. @@ -123,6 +122,16 @@ Document Wire.endTransmission() return values: http://www.arduino.cc/cgi-bin/yab DOCUMENTATION / EXAMPLES +Photos: + - Loop + - Analog Input (potentiometer and LDR on analog input 0) +Consistency: + - ledpin vs. ledPin + - value vs. val +Add a Brightness example where an analog input controls the analog output. +Graph example should use an intermediate variable. +Button example says pin 7 but uses pin 2. +Split Loop example in two (one that does loops, another that does arrays). Add LiquidCrystal library examples. Add Ethernet library examples. Add Wire library examples.