Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCP server vs HTTP server in vert.x

Tags:

vert.x

What is the difference between a TCP server/Net server in vertex and HTTP server?

What are the use cases for each?

I tried googling and went through the official website, none of them have a clear explanation.

like image 592
Sadanand Avatar asked Feb 14 '23 01:02

Sadanand


1 Answers

First off, in General Networking, there are 2 common types of handling connections. This can be done either over TCP (Transmission Control Protocol) or UDP (User Datagram Protocol). The most import difference between these two is that UDP will continuously send out streams/buffers of bytes without checking to see if the network packets made it to the other side of the line. This is useful in situations where security isn't much of an issue and where speed is important. Most VoIP services (Skype, Hangouts), XMPP (chat) and even YouTube (I think) use UDP for their streaming, as it has huge gains on performances and it doesn't matter all that much if a frame made it to the other side of the line, as the person could simply repeat themselves.

TCP on the other hand, is "secure" by default. It performs several handshakes on a regular basis with the endpoint so maintain connectivity and make sure that all packets are received on the other side of the line.

Now, there are a LOT of protocols out there in the Wild Wild West called Internet. List of TCP and UDP port numbers

As you can see, a lot of protocols support either TCP or UDP. HTTP on it's own is a TCP protocol with port 80 (as you might know). Therefore, HTTPServer is pretty much just an extension of a TCPServer, but with some add-ons such as REST. These add-ons are much welcome as HTTP processing is a pretty common use case. Without HTTPServer, you would need to declare loads of functions on your own.

like image 110
Rowan Kaag Avatar answered May 16 '23 09:05

Rowan Kaag