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:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
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)]
Created 18th August 2014, last changed 21st June 2018
Socket.NewTCPSocket - Socket.Peek
Feedback: Report problem or ask question.