Shabirmean Shabirmean -3 years ago 75
HTTP Question

Where are the HTTP, TCP packets created when communicating using a Java program?

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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download