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.

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."

(http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol)
http://en.wikipedia.org/wiki/TCP/IP

It would be my advice to read these articles because they are not very difficult but they explain a lot.
OSI model
http://www.tech-faq.com/osi-model.shtml
http://en.wikipedia.org/wiki/OSI_model

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.