Considering the example of an application or process that needs to send a particular request to a given server. How does the application initiate the process of creating the packet containing the request it wants to send, and what parties are involved in this process?

  • 1
    Unfortunately, questions about hosts/servers and applications are off-topic here. You could try to ask about the programming on Stack Overflow.
    – Ron Maupin
    Nov 20, 2022 at 19:34

1 Answer 1


Given that you tag your question with "TCP": Usually the application just sends the data to the OS kernel using send or similar system calls. Delivering the data including putting the data into packets are done by the OS. The rare exceptions to this are user space TCP/IP stacks.

Note that TCP is only a byte stream and has no message semantics. Any message semantics (like request, response) are only at the application level. There is no guaranteed 1:1 relation between a single send and a packet on the wire, i.e. the OS is free to split a single send over multiple packets, combine multiple send in a single packet etc.

  • Does send construct the whole packet? Nov 20, 2022 at 21:48
  • 1
    No, it doesn't construct any of the packet. It just sends the requested data to the requested destination. The operating system, network device drivers and other devices in the network perform the rest of the task. Try reading guides like this to learn more. Asking follow up questions in comments is not productive in this kind of environment. plixer.com/blog/network-layers-explained Nov 21, 2022 at 0:56
  • @FrameHowitzer, "It just sends the requested data to the requested destination." The data can't be sent by itself, it needs to get encapsulated first with all the remaining layers. send can't just send the data to the requested destination without the data being encapsulated first. The link that you provided merely explains what happens at each layer, which I'm familiar with, and does little if nothing to attempt to give a detailed account of how the process is implemented. It only deals with a high level abstraction, one that fails to answer the kind of question I am asking. Nov 21, 2022 at 11:29
  • @MehdiCharife, "one that fails to answer the kind of question I am asking." What you are asking is off-topic here. As I suggested in my comment, you could try to ask on Stack Overflow, but questions about hosts/servers and applications are off-topic here. We can answer questions about protocol theory for protocols at or below OSI layer-4, but not about specifics of what an application (above OSI layer-4) or host OS does. Those are things covered on other SE sites.
    – Ron Maupin
    Nov 21, 2022 at 14:48
  • @RonMaupin, My point was that the link the user FrameHowitzer provided doesn't answer the question I was asking, which they seem to think otherwise. I did not imply that my question was in-topic here. Your comment was already helpful in that regard. Nov 21, 2022 at 16:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.