Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   8.0    Statistic  

Socket.NewUDPSocket

Creates a new UDP Socket.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Socket 3.1 Yes Yes Yes Yes Yes

MBS( "Socket.NewUDPSocket" )

Parameters

none

Result

Returns a new socket ID or error message.

Description

Creates a new UDP Socket.
Socket reference numbers are starting at 29000 and counting up for each new socket.

Examples

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)]

See also

Example Databases


Socket.NewTCPSocket   -   Socket.Peek

Feedback: Report problem or ask question.




Links
MBS Xojo blog