int OpenUDPSocket ( int port )
Returns the socket number assigned to current session by
the system. If operation fails returns FAIL.
port - integer variable containing well-known port
to be used with the socket, or 0 if you want Windows Sockets to
select a port.
The User Datagram
Protocol (UDP) provides a connectionless, unreliable transport
service. Connectionless means that a communication session between
hosts is not established before exchanging data. UDP is often used
for communications that use broadcast or multicast Internet
Protocol (IP) packets. The UDP connectionless packet delivery
service is unreliable because it does not guarantee data packet
delivery or send a notification if a packet is not delivered.
However, if a packet is delivered, a checksum is computed over the
received data and matched against the checksum transmitted in the
packet. If these checksums do not match, the received UDP packet is
not handed up the stack to the next protocol layer on the receiving
Because delivery of UDP
packets is not guaranteed, applications that use this protocol must
supply their own mechanisms for reliability if necessary. Although
UDP appears to have some limitations, it is useful in certain
situations. UDP is efficient because of its low overhead.
Use this method to open
a UDP socket on specific port.
Plug in module:
The following example demonstrates the use of
# Example for OpenUDPSocket
# this script sends a message to a syslog
# syslog process usually runs on port 514
# refer to RFC 3164 for syslog message
string sIPAddress = "127.0.0.1"
int nPort = 514
int nSocket = OpenUDPSocket(0)
if(nSocket != FAIL)
Send message with Facility 11(MFT server) and Severity: 2
(Critical), 6 (Informational)
in this case Priority is calculated as
if (FindProcess("MFTServer.exe") ==
"<90>Oct 11 22:14:15
localhost MFT server is down"
sMessage = "<94>Oct 11 22:14:15 localhost MFT
server is up"
int nStatus = SendUDPData(nSocket, sIPAddress,
if (nStatus != OK)
Println("Could not send data to LogVision