The send() call writes data to the server application. The client and server can communicate the length of data transmitted, or the server can terminate its recv() loop when the client closes its connection.

char send_buf[BUFSIZE];

/* Initialize send_buf with your data. */

if ((numbytes = send(sockfd, send_buf, sizeof send_buf, 0)) == -1) {
      perror("send");
      goto close;
}