2

When I write a Java program that talks to an HTTP endpoint/server I would ideally use some library to create my HTTP request using the classes provided by that library and make the call.

I am trying to figure out where exactly does the packet creation happen for each step in the network stack? As in when I use these HTTP libraries are the HTTP packet creation handles by these libraries? Is it them who puts all the HTTP header information and append the data and create the packet?

And then where are the TCP packets assembled? Is it done at the kernel level? Is the created HTTP packet submitted to the kernel network module by the jvm and the kernel wraps the packet with TCP information and so on?

I'm trying to draw a clear picture of where each of these things happens so I could figure out where exactly I want to hack into for a project idea I have.

Thank You
Shabir

1 Answer 1

1

When I use these HTTP libraries are the HTTP packet creation handles by these libraries?

There is no such thing as an HTTP packet. There are HTTP requests and responses. See below.

Is it them who puts all the HTTP header information and append the data and create the packet?

The library creates the headers. The application provides the data.

And then where are the TCP packets assembled?

There is no such thing as a TCP packet. There are TCP segments, and IP packets (and Ethernet frames, ...). See below.

Is it done at the kernel level?

Yes.

Is the created HTTP packet submitted to the kernel network module by the JVM

Essentially yes.

and the kernel wraps the packet with TCP information and so on?

Yes. Specifically, the TCP layer of the network stack provides the TCP header and segment isding, the IP layer provides the IP header and packetising, etc.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you and excuse me for using the word header for all segments of the network stack.
You didn't. You used the word 'packet' for all layers of the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.