diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2009-05-08 13:11:04 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2009-05-08 13:11:04 +0000 |
commit | 5489db7185fd6175bfb7cc51b21dc9448c386066 (patch) | |
tree | ed2251df38d457744ddbb51bef4b7cd3cac7139a /libraries/Ethernet | |
parent | 72aa6bb2675c81de888e1a948ff86b51ea8115e2 (diff) |
Fixing bugs in Client::connect() (failed to set _sock to 255 after some connection failures).
Diffstat (limited to 'libraries/Ethernet')
-rw-r--r-- | libraries/Ethernet/Client.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libraries/Ethernet/Client.cpp b/libraries/Ethernet/Client.cpp index 13cf6bf..ebbb08d 100644 --- a/libraries/Ethernet/Client.cpp +++ b/libraries/Ethernet/Client.cpp @@ -42,13 +42,17 @@ uint8_t Client::connect() { if (_srcport + 1024 == 0) _srcport = 0; socket(_sock, Sn_MR_TCP, _srcport + 1024, 0); - if (!::connect(_sock, _ip, _port)) + if (!::connect(_sock, _ip, _port)) { + _sock = 255; return 0; + } while (status() != SOCK_ESTABLISHED) { delay(1); - if (status() == SOCK_CLOSED) + if (status() == SOCK_CLOSED) { + _sock = 255; return 0; + } } return 1; |