mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Hopefully fix repeated GET problem
Previously, if we issued http GET more than once every 30 seconds, the second GET would timeout. It seems this is because the code was using the same fixed port for src and dest - both were 80. Probably this caused a problem if the second GET happened before the first had closed
This commit is contained in:
parent
967e3da9e0
commit
1b42053c4e
@ -76,7 +76,11 @@ int net_wiznet_createsocket(JsNetwork *net, unsigned long host, unsigned short p
|
||||
NOT_USED(net);
|
||||
int sckt = -1;
|
||||
if (host!=0) { // ------------------------------------------------- host (=client)
|
||||
sckt = socket(net_wiznet_getFreeSocket(), Sn_MR_TCP, port, 0); // we set nonblocking later
|
||||
|
||||
//mgg1010 - added random source port - seems to solve problem of repeated GET failing
|
||||
|
||||
sckt = socket(net_wiznet_getFreeSocket(), Sn_MR_TCP, (rand() & 32767) + 2000, 0); // we set nonblocking later
|
||||
|
||||
if (sckt<0) return sckt; // error
|
||||
|
||||
int res = connect((uint8_t)sckt,(uint8_t*)&host, port);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user