Version 17 of UDP

Updated 2003-03-04 10:15:27

UDP is an unreliable packet oriented network protocol (tecnically the User Datagram Protocol; datagrams are an older name for packets.) This is the datagram partner to the stream oriented TCP. The Tcl core has supported TCP sockets with the socket comment since version 7.something but UDP must be supplied by an extension. The following extensions provide UDP support:

The TclUDP package supports UDP sockets on Windows and un*x with fileevent handling and has recently been enhanced to support the TEA2 build system and to enable the transmission of binary data. It is now a project at sourceforge [L1 ] and the lastest releases will be available at [L2 ]

Also http://students.cs.tamu.edu/mmiller/tcl/channel.html .


UDP enabled packages

In tcllib - the dns package is capable of using udp if available. Also the forthcoming time and ntp packages. [PT]


30Jan2003 Mike Tuxford It was mentioned in c.l.t that there aren't many examples of tcludp usage around so I'll add this simple one that listens on port 1434 which is the MSSQL port and has been in the news a lot lately due to major exploits.

 proc udpEventHandler {} {
   global fd
   puts "event triggered..."
   puts "Data: [gets $fd(udp)]"
   puts "Peer: [udp_conf $fd(udp) -peer]"
   return
 }

 set fd(udp) [udp_open 1434]
 fileevent $fd(udp) readable udpEventHandler
 puts "Listening on udp port: [udp_conf $fd(udp) -myport]"

 vwait __forever__

[ Category Internet ]