aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "question about tcp/ip vs UDP" Watch "question about tcp/ip vs UDP" New topic
Author

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.
Thanks,
Dan.


Kishore
SCJP, blog
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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
Ernest,
Thanks for that insight.
Kishore.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

also keep in mind that many firewalls block UDP packets


SCJP
Visit my download page
 
Don't get me started about those stupid light bulbs.
 
subject: question about tcp/ip vs UDP