Hi Guys..

Can someone explain to me what's the difference between sending any data over a socket vs sending an http request? i mean sending an http request would also be happening over a TCP socket, am i right? so basically it's as simple as sending data from client socket to server socket but in a certain format and the server socket is also designed to accept that particular format, is that correct?

someone please clarify.

8 Years
Discussion Span
Last Post by tzushky

A socket is one end of a communication channel (between server and client for example).

The requests going through the socket may be of many types depending on the protocol that you implement(TCP/IP, HTTP...)

If you have the simplest possible example of a server and a client program each having their socket (client socket is actually bound to the server IP and open port), you can send ANYTHING through, your message will be available exactly the same exactly the same. The protocol headers are invisible at the other end unless you use something to see them (s sniffer, Wireshark...)

The basic difference is that TCP/IP is a protocol of lower Layer =TCP(transport=4) and IP(network =3) (if you are familiar with the 7 layer communication model) than HTTP which is layer 6(presentation)

can be "implemented on top of any other protocol on the Internet, or on other networks. HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used."


It would be my advice to read these articles because they are not very difficult but they explain a lot.
OSI model

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.