Kill the write buffer and just write directly to the socket. Catch errors and kill the fd when necessary.
Attach a file by drag & drop or click to upload