Go Down

Topic: Ethernet shield server.write vs server.print (Read 1 time) previous topic - next topic


They should have hidden write()

Since the Client class derives from Stream, which derives from Print, and the Server class derives from Print, this would have been impossible, since both print() and write() are public methods in the Print class. Serial also derives from Print, and in Serial you most definitely want to be able to send both ASCII ("32") and binary (32) data.


It would have taken a little bit of work, but definitely possible.  Server could have derived privately from Print and then thoughtfully exposed only the interface that's needed to users.

Go Up