send()

This is used for sending the specified message to another socket. The socket needs to be in a connected state before you can invoke this function. Here is its syntax:

       ssize_t send(int fdsock, const void *buf, size_t length, int flags);

Here, fdsock represents the file descriptor of the socket through which a message is to be sent, buf points to the buffer that contains the message to be sent, length represents the length of the message to be sent in bytes, and flags specifies the type of message to be sent. Usually, its value is kept at 0.

Get Practical C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.