Go Down

Topic: Ethernet Shield sending byte by byte? (Read 6 times) previous topic - next topic

myerika

When sending data (the response to the client) via the Ethernet Shield I can see in the Network Analyze program (Wireshark) all data are sent byte by byte. For that reason there are a lot of interactions between the client and the server. Are there any possibilities to send the response in one "block" over the network. Total data length is approx 300 bytes  

follower

That's a very interesting observation. In theory, yes, I think that should be possible. You'd need to look more closely to see how the library is implemented. Have you tried the Ethernet2 library? If so, does it function the same way?

--Phil.

myerika

Yes, I have tryed Ethernet2 and I got the same result, one byte sent from the server and then a response (Ack) from the client and then next byte ..... and so on.

follower

A quick look at this suggests the reason for the issue is that the client send code is implemented on top of the Print class and at the bottom of the "stack" is a routine that prints a byte. And to print a string that routine gets called multiple times.

I don't know if it's possible to override the higher-level methods but it would seem worthwhile as this must be adding a fair bit of overhead. The underlying ethernet code is certainly capable of sending multiple bytes.

--Phil.

follower

I took a look at this since I was using WireShark to track down another issue (with my code/Adobe Flash not the library :-)).

I can confirm what the OP posted, in my case for each byte of data sent via println 60 bytes were actually being sent on the wire--this includes for the response headers etc.

Unfortunately trying to solve this raises the whole issue of buffering etc which means it's not quite a straight fix of println. Although if the data isn't in PROGMEM then it's probably more straight-forward but that's hardly ideal.

Will ponder.

--Phil.

Go Up