Hi LRA,
There may be an issue with the energia ethernet library. This is what I ended up doing:
Modify the EthernetClient.cpp file and add a custom write function. It is the same as the one already there but comment out this "if (cs->mode)"
Declare the function in the EthernetClient.h as "virtual size_t write_1(const uint8_t *buf, size_t size);"
Or simply modify the the existing write function and replace the code with this
size_t EthernetClient::write_1(const uint8_t *buf, size_t size) {
uint32_t i = 0, inc = 0;
boolean stuffed_buffer = false;
struct tcp_pcb * cpcb = (tcp_pcb*)cs->cpcb; /* cs->cpcb may change to NULL during interrupt servicing */
if (!cpcb)
return 0;
// Attempt to write in 1024-byte increments.
while (stuffed_buffer == false) {
err_t err = tcp_write(cpcb, buf, size, (0x01));
if (err != ERR_MEM) {
tcp_output(cpcb);
//delay(1); //new addition
stuffed_buffer = true;
} else {
if (stuffed_buffer == false){
tcp_output(cpcb);
//delay(1); //new addition
stuffed_buffer = false;
}else{
//delay(1);
}
}
//delay(1);
}
return size;
}