UdpListen
Script function

world.UdpListen

DOC_scripting Read about scripting

Type

Method

Summary

Listens for incoming packets using the UDP protocol

Prototype

long UdpListen(BSTR IP, short Port, BSTR Script);

DOC_data_types View list of data type meanings


Description

This lets you set up a plugin script function that will be called whenever a UDP packet arrives on the specified port.

This lets you set up a separate program which can communicate with MUSHclient by sending it UDP packets.

To listen to messages from any address use the address "0.0.0.0".

The address must be a dotted number, not a name (eg. "10.0.0.8")

You can cancel a listener by calling this function (for a previously-setup port) with an empty script name.



VBscript example

UdpListen "0.0.0.0", 4111, "MyScript"



Jscript example

UdpListen ("0.0.0.0", 4111, "MyScript")



Lua example

UdpListen ("0.0.0.0", 4111, "MyScript")



Return value

eNotAPlugin: This must be called from a plugin
eBadParameter: The port is already in use by another plugin, or the UDP socket could not be created
eNoNameSpecified: No script name was specified
eOK: succeeded


DOC_errors View list of return code meanings


See Also ...

Functions

FNC_GetUdpPort GetUdpPort (Find a free port for UDP listening)
FNC_UdpPortList UdpPortList (Returns an array of all the UDP ports in use by this world)
FNC_UdpSend UdpSend (Sends a packet over the network using the UDP protocol)

(Help topic: function=UdpListen)

DOC_contents Documentation contents page