File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes question about tcp/ip vs UDP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "question about tcp/ip vs UDP" Watch "question about tcp/ip vs UDP" New topic

question about tcp/ip vs UDP

Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
I was asked in a interview regarding differene between TCP/IP and UDP.
Can someone shed a light on this issue. Its been almost a decade after I read anything technical related to TCP/IP.

SCJP, blog
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Note that both TCP and UDP are built on top of IP, so it's TCP/IP vs. UDP/IP that we're talking about here.
In the simplest terms, TCP is a reliable, connection-oriented protocol, while UDP is a connectionless, unreliable protocol. UDP is for sending individual datagrams which may get lost, arrive out of order, or otherwise not form any kind of dependable sequence. TCP is for the more formal kind of "connect to another machine, send a string, receive a string back, close the connection" kind of networking.
The price you pay for reliablity, of course, is performance. TCP has a lot more overhead than UDP, and doesn't work well on dodgy network links.

[Jess in Action][AskingGoodQuestions]
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
Thanks for that insight.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

also keep in mind that many firewalls block UDP packets

Visit my download page
I agree. Here's the link:
subject: question about tcp/ip vs UDP
It's not a secret anymore!