Suppose I open a socket connection to a remote host, using either an SSLSocket (classic) or having set a particular security level on a TCPSocket (new framework). Suppose also the connection attempt succeeds and I now wish to send a short message to the host using socket.write or .writedata.
It's unclear to me whether each such .write is encrypted and sent ASAP or whether there is an attempt to group them together before sending. All my writes, even those of only a few bytes, seem to go out immediately so I am curious as to how this is organised.
I'm looking into this because at the moment I'm waiting for data to be transmitted (by polling and checking status) before moving on to a read, and I wonder whether I need to bother (I note that the new framework doesn't have a flush method). One place where it might be important is at the moment the connection is to be terminated. It appears that I must send QUIT to the other end (a mail host), otherwise it doesn't delete mails for which I've requested deletion. As I'm doing all this in a thread, I don't want to send the QUIT and then have the thread exit before the message is actually sent to the remote end.
Any comments as to how this works would be appreciated.