1. Technology
Chat application with Delphi source
Full Delphi source code to a simple Chat application. Learn how UDP (User Datagram Protocol) broadcast can be used to find partners with unknown IP addresses in the network.
 More of this Feature
• Chat SOURCE CODE
 Join the Discussion
"Post your views, comments, questions and doubts to this article."
Discuss!
 Related Resources
• Internet/Network Programming
• Indy programming
• Free source Delphi apps.

Article written by Michael Schnell

Everybody doing some sockets programming is quite familiar with TCP. Most do know UDP and think it's an inferior protocol, as it does not ensure that the data bytes sent will arrive at the other site. Thus, UDP imposes less network overhead than TCP and gives the programmer more freedom and more labor by forcing him to deal with the security of the data transport himself.
But there are more UDP vs. TCP differences than obvious at the first sight.

Let's UDP Chat!
The example Chat program demonstrates how UDP broadcast can be used to find partners with unknown IP addresses in the network. While the "chat" application is a good candidate to use the "streaming" structure of TCP, here a UDP implementation is done. Provided the "connectionless" ways of UDP, multiple partners can send to a single network device.
The implementation shown only allows to send an answer to the sender of the last message, or to type in the recipient's IP address or host name (try "localhost" here). A nice enhancement would be to implement a way of selecting the addressee from the list of received messages.

Delphi UDP Chat in action

Download Delphi UDP Chat

Looking for more TCP/Indy source applications? Try Screen Thief, or Sending email messages.

©2014 About.com. All rights reserved.