Skip to content

flush() is a TX related function #4018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JAndrassy opened this issue Dec 24, 2017 · 7 comments · Fixed by #4029
Closed

flush() is a TX related function #4018

JAndrassy opened this issue Dec 24, 2017 · 7 comments · Fixed by #4029

Comments

@JAndrassy
Copy link
Contributor

JAndrassy commented Dec 24, 2017

WiFiClient.flush should send all data from tx buffer. it is not true that in Arduino world it is a rx buffer thing. the Client class is inherited from Print class and the flush method is from Print. And in Print implementations the flush is a tx thing. And the reference for the Client class implementation is Ethernet library.

@d-a-v
Copy link
Collaborator

d-a-v commented Dec 25, 2017

Duplicate of issue #1002.
This has been very recently fixed by #3967 and is currently in git master (not 2.4.0-rc2).

@devyte
Copy link
Collaborator

devyte commented Dec 25, 2017

Closing as duplicate of #1002 .

@devyte devyte closed this as completed Dec 25, 2017
@d-a-v
Copy link
Collaborator

d-a-v commented Dec 25, 2017

@JAndrassy (from #3967)

and moving flush() from Stream to Print?

The ::flush() beeing a tx not rx stuff was #1002's point and fix is merged.
::flush() in arduino is declared in Print:: which is inherited by Stream::, and our flush() is declared only in Stream::.

So you were suggesting for moving it to Print:: ?
Can you please elaborate ?

@JAndrassy
Copy link
Contributor Author

JAndrassy commented Dec 26, 2017

flush() accompanies write functions in Print. so yes it should be in Print. Stream adds read functions. flush() is important for effective implementations of write() with buffering.

btw: most Arduino users (programmers) do not use flush(). Therefore in my implementations of Print (mostly derived from Stream or Client) I add flush into available() if rx buffer is empty and tx buffer is not sent. It is much better the sending by one byte over some protocol with frame bytes overhead.

@d-a-v
Copy link
Collaborator

d-a-v commented Dec 26, 2017

Since current implementation does not exactly follows arduino's core library, this is a fair proposal.
Have you considered making yourself a pull request for this ?

@JAndrassy
Copy link
Contributor Author

no, because it would take to much time for me to fork the project and set it up for testing

@d-a-v
Copy link
Collaborator

d-a-v commented Dec 26, 2017

I hope you'll have time to try #4029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants