Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minimal changes to support receiving long browseUrl responses - call …

…persistTcpConnection(true) before browseUrl to enable
  • Loading branch information...
commit 3a1e5e0fccb7bb0a35445a9feee29ca1e101afad 1 parent b26a3f3
@vicatcu vicatcu authored
Showing with 18 additions and 2 deletions.
  1. +1 −0  EtherCard.cpp
  2. +5 −0 EtherCard.h
  3. +12 −2 tcpip.cpp
View
1  EtherCard.cpp
@@ -341,6 +341,7 @@ uint8_t EtherCard::dnsip[4]; // dns server
uint8_t EtherCard::hisip[4]; // dns result
uint16_t EtherCard::hisport = 80; // tcp port to browse to
bool EtherCard::using_dhcp = false;
+bool EtherCard::persist_tcp_connection = false;
uint8_t EtherCard::begin (const uint16_t size,
const uint8_t* macaddr,
View
5 EtherCard.h
@@ -130,6 +130,8 @@ class EtherCard : public Ethernet {
static uint8_t hisip[4]; // dns result
static uint16_t hisport; // tcp port to connect to (default 80)
static bool using_dhcp; // whether dhcp is active or not
+ static bool persist_tcp_connection; // whether to break connections on first packet received
+
// EtherCard.cpp
static uint8_t begin (const uint16_t size, const uint8_t* macaddr,
uint8_t csPin =8);
@@ -164,6 +166,9 @@ class EtherCard : public Ethernet {
// new stash-based API
static uint8_t tcpSend ();
static const char* tcpReply (byte fd);
+
+ static void persistTcpConnection(bool persist);
+
// dhcp.cpp
static void DhcpStateMachine(word len);
static uint32_t dhcpStartTime ();
View
14 tcpip.cpp
@@ -631,8 +631,14 @@ word EtherCard::packetLoop (word plen) {
if (tcpstart+len>plen)
save_len = plen-tcpstart;
(*client_tcp_result_cb)((gPB[TCP_DST_PORT_L_P]>>5)&0x7,0,tcpstart,save_len);
- make_tcp_ack_from_any(len,TCP_FLAGS_PUSH_V|TCP_FLAGS_FIN_V);
- tcp_client_state = 6;
+
+ if(persist_tcp_connection){
+ make_tcp_ack_from_any(len,TCP_FLAGS_PUSH_V);
+ }
+ else{
+ make_tcp_ack_from_any(len,TCP_FLAGS_PUSH_V|TCP_FLAGS_FIN_V);
+ tcp_client_state = 6;
+ }
return 0;
}
}
@@ -666,3 +672,7 @@ word EtherCard::packetLoop (word plen) {
}
return 0;
}
+
+void EtherCard::persistTcpConnection(bool persist){
+ persist_tcp_connection = persist;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.