What protocol is more suitable for chatting program

135 pts.
Tags:
TCP
Transmission Control Protocol
UDP
User Datagram Protocol
Which protocol is more suitable for writing a chatting program, either TCP or UDP?

Software/Hardware used:
JAVA (JDK1.6.0)

Answer Wiki

Thanks. We'll let you know when a new response is added.

<i>TCP is preferred rather than UDP</i>

TCP is preferred if you want to know if it was received correctly. UDP is preferred if you don’t care if it’s received.

You might start coding a chat function with UDP. As long as the function works as well as you need, stick with it. If the messages aren’t critical, it probably doesn’t matter.

But if you really need to know that the message went through with no errors, then code to the full TCP protocol. If you already have it working with UDP, you can almost just add all of the extra pieces for TCP including error recovery.

UDP is simpler and easier than TCP. But it provides less certainty.

Tom

=================================================

from what i have seen most of the time is tcp but i might be wrong too..so if others would comment would be great

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Rajeshu
    thank u friend, I also referred many websites reg this and i found its TCP in most of them. I would like to know why TCP is preferred rather than UDP. I'll be glad if someone clarifies this think
    135 pointsBadges:
    report
  • Rajeshu
    thank 4 ur clarification friend
    135 pointsBadges:
    report
  • petkoa
    Well, historically, talk - maybe the first p2p chat, was UDP-based; a way more advanced IRC is TCP-based... Choice is yours Now, from a sysadmin point of view - recently, torrent clients switched to UDP and, at least in an academic environment like ours , several student's notebooks are able to saturate the outgoing link. So now, all UDP except DNS (p. 53) and NTP (p. 123) is forbidden and torrent clients (un?)happily fall-back to TCP. In such environment an UDP-based chat program will not work in spite its traffic requirements are very small (e.g., all-UDP based old Skype clients are not working; newer, which can fall-back to TCP are operative) . So, if you decide to have UDP functionality, better make a provision for TCP fall-back.
    3,120 pointsBadges:
    report
  • TomLiotta
    Now, from a sysadmin point of view... at least in an academic environment like ours... I'd expect to run into it outside of academia as well. I'd also, however, wonder about the eventual consequences to bandwidth of forcing all UDP to be converted to TCP. It seems like it would eventually defeat any purpose involving conservation of bandwidth. Maybe not. Anyway, I definitely agree with keeping TCP fall-back in mind. That especially depends upon the environment within which the application must run. It's one thing to create an app that's intended for local users; it can be very different when there are totally unknown network segments to cross. Tom
    125,585 pointsBadges:
    report
  • petkoa
    I’d expect to run into it outside of academia as well. May be - I hoped rules about software allowed on personnel notebooks should be better defined in non-academic environments :o)). I’d also, however, wonder about the eventual consequences to bandwidth of forcing all UDP to be converted to TCP. It seems like it would eventually defeat any purpose involving conservation of bandwidth. TCP is not only about acknowledgment of packets arrival and retransmission of lost packets, it is much more about self-regulation - if a peer (in TCP connection) doesn't receive couple of ACK's, it decreases the rate of sending and this is built in the OS TCP stack, not in torrent (or any other) client. So a fall-back to TCP really alleviates the bandwidth problem even without any traffic shaping (btw, the first time I experienced the UDP problem and its TCP alleviation was about 12yrs ago, when a guy in our campus "experimented" with an outbound X11-session over 119 Kbit line and saturated it... after being warned and some bitching about our "mostly incoming activity" he switched to ssh X11 forwarding, and problem was solved).
    3,120 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following