sa_send_udp system procedure

Sends a UDP packet to the specified address.

Syntax
sa_send_udp( 
destAddress, 
destPort, 
msg 
)
Arguments
  • destAddress   Use this CHAR(254) to specify either the host name or IP number.

  • destPort   Use this UNSIGNED SMALLINT parameter to specify the port number to use.

  • msg   Use this LONG BINARY parameter to specify the message to send to the specified address. If this value is a string, it must be enclosed in single quotes.

Remarks

This procedure sends a single UDP packet to the specified address. The procedure returns 0 if the message is sent successfully, and returns an error code if an error occurs. The error code is one of the following:

  • -1 if the message is too large to send over a UDP socket (as determined by the operating system) or if there is a problem with the destination address

  • the Winsock/Posix error code that is returned by the operating system

If the msg parameter contains binary data or is more complex than a string, you may want to use a variable. For example,

CREATE VARIABLE v LONG BINARY;
SET v='This is a UDP message';
SELECT dbo.sa_send_udp( '10.25.99.124', 1234, v );
DROP VARIABLE v;

This procedure can be used with MobiLink server-initiated synchronization to wake up the Listener utility (dblsn.exe). If you use the sa_send_udp system procedure as a way to notify the Listener, you should append a 1 to your UDP packet. This number is a server-initiated synchronization protocol number. In future versions of MobiLink, new protocol versions may cause the Listener to behave differently.

Permissions

DBA authority required

Side effects

None

Example

The following example sends the message "This is a test" to IP address 10.25.99.196 on port 2345:

CALL sa_send_udp( '10.25.99.196', 2345', 'This is a test' );