Download ActiveSocket Network Communications Toolkit 4.0  (5240 KB - .exe file)
Download Manual  (505 KB - .htm file)
ActiveSocket - Udp Object
The ActiveSocket Udp object is based on the Transport Control protocol (UDP) protocol. User Datagram Protocol (UDP) is one of the core protocols of the Internet protocol suite. Using UDP, programs on networked computers can send short messages sometimes known as datagrams (using Datagram Sockets) to one another. UDP is sometimes called the Universal Datagram Protocol or Unreliable Datagram Protocol.
UDP does not guarantee reliability or ordering in the way that TCP does. Datagrams may arrive out of order, appear duplicated, or go missing without notice. Avoiding the overhead of checking whether every packet actually arrived makes UDP faster and more efficient, at least for applications that do not need guaranteed delivery. Time-sensitive applications often use UDP because dropped packets are preferable to delayed packets. UDP's stateless nature is also useful for servers that answer small queries from huge numbers of clients. Unlike TCP, UDP supports packet broadcast (sending to all on local network) and multicasting (send to all subscribers).
The Udp object is part of the ActiveSocket component. Overview of all ActiveSocket objects:
» Icmp
» Http
» Ftp & FtpFile
» DnsServer & DnsRecord
» Ntp
» Ssh
» Rsh
» SnmpManager
» SnmpTrapManager
» SnmpMibBrowser
» Tcp
» Udp
» IPtoCountry
» Wake-on-LAN
Udp Sample code
VBScript UDP client/server sample: CLIENT.VBS
' Create a socket instance
Set objUdp = CreateObject ( "ActiveXperts.Udp" )
Set objConstants = CreateObject ( "ActiveXperts.ASConstants" )
objUdp.Open "localhost", 1500, True ' Listen for connection on port 1500
WScript.Echo "StartListening, result: " & objUdp.LastError
If objUdp.LastError <> 0 Then
WScript.Quit
End If
Do While str <> "Quit"
str = objUdp.ReceiveString
If( objUdp.LastError = 0 And str <> "" ) Then
WScript.Echo "ReceiveString: " & str
End If
objUdp.Sleep 100
Loop
objUdp.Disconnect
VBScript UDP client/server sample: SERVER.VBS
' Create a socket instance
Set objUdp = CreateObject ( "ActiveXperts.Udp" )
Set objConstants = CreateObject ( "ActiveXperts.ASConstants" )
' Make a connection to port 1500 on remote server
objUdp.Open "127.0.0.1", 1500, False
WScript.Echo "Connect, result: " & objTcp.LastError
If objUdp.LastError <> 0 Then
WScript.Quit
End If
objUdp.SendString "Hello, world!"
WScript.Echo "SendString, result: " & objUdp.LastError
objUdp.SendString "Quit"
WScript.Echo "SendString, result: " & objUdp.LastError
' And finally, disconnect
objUdp.Close
On ftp.activexperts-labs.com, you can find a lot of ActiveSocket samples. These samples are also part of the ActiveSocket installation.
» Visit ftp.activexperts-labs.com
|