Difference between Write and Print, for TCPClient

What is the difference between Write and Print for TCPClient/Server? In the references they seem to do the same thing.

they are indeed similar, have a look at Serial.print/write in the docs, that spells out the differences

A long time ago we found that using the print method in TCP client caused issues, and slowed things down, im not sure if thats still the case, but i still use client.write wherever i can. here is a the function i now use in place of client.print()

/* out - outputs supplied string to TCPclient */
void out(const char *s) {

client.write( (const uint8_t*)s, strlen(s) );

if (DEBUG)Serial.write( (const uint8_t*)s, strlen(s) );


The difference is that print()is meant for printable data while write() is also good for non-printables like '\0'. You could not send a stream that contains a zero-byte via print().
print() also has several overloads to format numeric value types into printable numbers while write() only transmits the raw bytes.

But as @Hootie81 said, looking in the docs (first) never hurts :wink: