Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
Statistic
FMM
Blog
Creates a new UDP Socket.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Socket | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
none
Returns a new socket ID or error message.
Create a new UDP Socket:
Set Variable [$$sock; Value:MBS("Socket.NewUDPSocket")]
Create a new UDP socket for broadcast and listen on a port:
If [not (GetAsNumber($$sock) > 0)]
Set Variable [$$sock; Value:MBS("Socket.NewUDPSocket")]
If [GetAsNumber($$sock) = 0]
Show Custom Dialog ["Failed to create Socket"; $$sock]
Exit Script []
End If
End If
Set Variable [$r; Value:MBS("Socket.Listen"; $$sock; UDP Broadcast::Port)]
Set Field [UDP Broadcast::Send Result]
Set Variable [$r; Value:MBS("Socket.SetDataAvailableHandler"; $$sock; Get(FileName); "ReadMessage")]
Set Variable [$r; Value:MBS("Socket.SetBroadcast"; $$sock; 1)]
Set Variable [$r; Value:MBS("Socket.SetMulticastLoop"; $$sock; 0)]
This function checks for a license.
Created 18th August 2014, last changed 21st June 2018