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.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
Socket.SendMessage
Sends an UDP data message.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| Socket | 3.1 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| SocketID | The socket ID received by Socket.Connect function. | $sock | |
| IP | The target IP or name. | "192.168.2.10" | |
| Port | The target port to send to. | 9000 | |
| Text | The text to send. | "Hello World" | |
| Encoding | The text encoding for text parameter. Default is native. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF8" | Optional |
Result
Returns the number of bytes written or an error message.
Description
Sends an UDP data message.Examples
Write something:
MBS( "Socket.SendMessage"; $sock; "Hello World" )
Write something with DOS text encoding:
MBS( "Socket.SendMessage"; $sock; "Umlauts: äöü"; "DOS" )
Send UDP Package:
Set Variable [$r; Value:MBS("Socket.SendMessage"; $$sock; UDP Broadcast::BroadcastAddress; UDP Broadcast::Port; UDP Broadcast::Message To Send; "UTF-8")]
If [GetAsNumber($r) = 0]
Set Field [UDP Broadcast::Send Result; "Failed to Send: "&$r]
Else
Set Field [UDP Broadcast::Send Result; "Sent "&$r&" Bytes."]
End If
Opens stream to Midi device and plays notes with time offsets:
Set Variable [$DeviceName; Value:"Your device name"]
If [$$stream = ""]
Set Variable [$$stream; Value:MBS("PortMidi.OpenOutput"; $DeviceName; 100; 10)]
If [MBS("ISError")]
Show Custom Dialog ["Failed to open Device"; $$stream]
End If
End If
#Send notes
Set Variable [$ts; Value:MBS( "PortMidi.TimeStamp" )]
Set Variable [$r; Value:MBS("PortMidi.SendMessage"; $$stream; 144; 48; 95; $ts )]
Set Variable [$r; Value:MBS("PortMidi.SendMessage"; $$stream; 128; 48; 0; $ts + 500 )]
Set Variable [$r; Value:MBS("PortMidi.SendMessage"; $$stream; 144; 50; 95; $ts + 1000 )]
Set Variable [$r; Value:MBS("PortMidi.SendMessage"; $$stream; 128; 50; 0; $ts + 1500 )]
Set Variable [$r; Value:MBS("PortMidi.SendMessage"; $$stream; 144; 52; 95; $ts + 2000 )]
Set Variable [$r; Value:MBS("PortMidi.SendMessage"; $$stream; 128; 52; 0; $ts + 2500 )]
See also
- IsError
- PortMidi.OpenOutput
- PortMidi.SendMessage
- PortMidi.TimeStamp
- Socket.Connect
- Socket.SendMessageHex
Example Databases
Created 18th August 2014, last changed 23th January 2017
Socket.SSL.UsePrivateKeyFile - Socket.SendMessageHex
Feedback: Report problem or ask question.
Links
MBS Xojo PDF Plugins