diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2009-01-07 21:16:45 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2009-01-07 21:16:45 +0000 |
commit | c0550aac8c93e81828a8cc10ac2e4ee5e0f83e16 (patch) | |
tree | 9aef80f0b294720231c89321bc8d90c6c3c7767c | |
parent | 1cee12bada4a155565b057b0ab036d6b3f3484b4 (diff) |
Originating each outgoing network connection from a different source port (in the Client class of the Ethernet library).
Updating readme and todo.
-rw-r--r-- | libraries/Ethernet/Client.cpp | 6 | ||||
-rw-r--r-- | libraries/Ethernet/Client.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libraries/Ethernet/Client.cpp b/libraries/Ethernet/Client.cpp index 9d3e0df..6c19b8f 100644 --- a/libraries/Ethernet/Client.cpp +++ b/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/libraries/Ethernet/Client.h b/libraries/Ethernet/Client.h index 5911b95..f269e9b 100644 --- a/libraries/Ethernet/Client.h +++ b/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; |