Difference Between Send and Write

Socket programming is considered to be a method of programming in which networks are being connected by two different nodes to each other to function the programming.


IT Quiz

Test your knowledge about topics related to technology

1 / 10

Machine becomes intelligent once they are

2 / 10

How many numbers of home pages a web site can contain

3 / 10

The output printed by a computer through a printer on the paper is called

4 / 10

Who founded Apple Computers?

5 / 10

A process that is repeated, evaluated, and refined is called __________

6 / 10

Which two websites offer free e-mail services?

7 / 10

Geo-stationary satellite revolves at –

8 / 10

Which American Computer Company is also known by the nick name "Big Blue"

9 / 10

Which web browser is developed by the Google

10 / 10

Which is an Input device

Your score is


Out of the two nodes or sockets, one tends to be on a specific port at an IP junction, while on the other hand, the other socket or node extends to reach out to the other port to ultimately form a connection in the network.

Key Takeaways

  1. “Send” refers to transferring information or messages from one place to another, while “write” refers to producing written or printed material.
  2. “Send” is typically used in email, instant messaging, or other electronic means, while “write” is more commonly used in creating documents, books, or other written material.
  3. “Send” implies a transfer of information, while “write” means creating new knowledge.

Send vs Write

Send is a type of function used in socket programming. Send function can be used on both linux and unix operating systems. Message length is defined in bytes by the send function. Write function can be used to find errors. The operating system on which write function can be used is linux. This function also allows data transmission.

Send vs Write

Want to save this article for later? Click the heart in the bottom right corner to save to your own articles box!

The send() function in the socket programming must start the transmission of any message from a specific socket or node to the other port to initiate the networking.

The function send must always be maintained to send messages when the required sockets are connected to each other for network programming. 

The Write() function in the socket programming has the capability to detect errors in the files and must follow to write always nbyte bytes from an associated buffer which is pointed to by a buf to another file which is then associated with the open file descriptors for the purpose of networking in socket programming.

Comparison Table

Parameters of ComparisonSendWrite
SocketThe Send() function actually specifies the socket file descriptors.Does not distinguish the socket file descriptor.
Operating systemUnix, Linux operating system.Write() can be used on Linux operating system.
BufferThe send() function tends to point to the buffer that contains the message.The write() function must attempt to write from the buffer that is pointed to.
LengthThe send() function specifies the message length in bytes.The length of the file is made set according to the specific file offset.
FlagsThe send() function allows you to specify flags.No need to specify the number of flags.

What is Send?

The send() function in the socket programming basically tends to specify the socket file descriptors, and it must start the transfer of messages from a specific socket to the peer connected.

Whenever the socket in the network is connected, then shall the send() function send a message with the connected socket to perform networking.  

The send() function also tends to point to the specific buffer that is meant to contain the messages which are supposed to be sent by the function to process further system.

The send() function also focuses on specifying the specific length of the message in bytes that would be sent and transferred by the function.

The send() function allows the sender to specify the number of flags used, which is not the case with other functions of system call.

The function also tends to point to the specific buffer that is the storage of the message that must be sent and then also specifies the socket file descriptors in the process of networking.


What is Write?

The write() function in the socket programming is considered to be one of the basic system calls that are provided by an operating system for networking purposes.

The write() function focuses on attempting to write nbyte bytes starting from the pointed buffer to by buf to another file which is associated with an open file descriptor in the socket programming.

The write() function tends to write data from a specific buffer to another particular device that is already given, for example, a file. 

This method of transmission is considered the primary way to transmit data from a specific program by using a definite system call, in this case, the write() function.

The destination of the message transmitted is followed and identified by a code that is numeric, and the specific data which is to be written is identified by a pointer and also a size that is given by the number of bytes. 

The writing of a specific data must continue starting from the point in the file, which is denoted by the offset, which is then associated with other files, and if the offset file is much greater in length than the original length of the file, then the length of the file is set to offset file.

The Write() function is an advantage for using it as a generalization. It is actually created for transferring data in network programming.  


Main Differences Between Send and Write

  1. The Send() function in socket programming tends to specify the type of socket file descriptor, while the write() function doesn’t really specify any file descriptor.
  2.  The Send() function works on Unix, Linux operating system. Whereas the Write() function works on Linux Operating System.
  3. The Send() function focuses on pointing to the buffer that has the message needed to be sent. On the other hand, the Write() function focuses on attempting to write from the buffer that is pointed to.
  4. While working with the Send() function, it allows to specify the number of flags, but in the Write() function, there is no need to specify the number of flags. 
  5. In the matter of length, the Send() function specifies the length of the message sent by bytes. While the Write() function tends to set the length of the file according to file offset.
  1. https://dl.acm.org/doi/abs/10.1145/1966445.1966460
  2. https://www.usenix.org/events/sec03/tech/full_papers/provos/provos_html
One request?

I’ve put so much effort writing this blog post to provide value to you. It’ll be very helpful for me, if you consider sharing it on social media or with your friends/family. SHARING IS ♥️

Leave a Comment

Your email address will not be published. Required fields are marked *