Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Binds the socket to the port and starts listening.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Socket | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
SocketID | The socket ID received by Socket.Connect function. | $sock | |
Port | The port number to listen at. If port is zero, we pick a random free port number, which you can query with Socket.LocalPort function. |
8000 | |
backlog | Available in MBS FileMaker Plugin 9.1 or newer. The back log for connection. How many pending connections can be accepted on this socket. Once you call Socket.AcceptNewConnection, an entry is removed here. Default is 3. |
3 | Optional |
Returns OK or error message.
Listen to a given Port:
Set Variable [$r; Value:MBS("Socket.Listen"; $$sock; 12345)]
Create TCP Socket listening on a port:
Set Variable [$$sock; Value:MBS("Socket.NewTCPSocket")]
If [MBS("IsError")]
Show Custom Dialog ["Failed to create Socket"; $$sock]
Exit Script []
End If
Set Variable [$r; Value:MBS("Socket.SetNewConnectionHandler"; $$sock; Get(FileName); "NewConnection")]
Set Variable [$r; Value:MBS("Socket.SetErrorHandler"; $$sock; Get(FileName); "SocketError")]
Set Variable [$r; Value:MBS("Socket.Listen"; $$sock; TCP Receiver::ListenPort)]
If [MBS("IsError")]
Show Custom Dialog ["Failed to create Socket"; $$sock]
Exit Script []
End If
This function checks for a license.
Created 18th August 2014, last changed 10th January 2023