Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Socket Test

All examples are included with download of MBS FileMaker Plugin.

Socket Test.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 5
Value Lists 0
Custom Functions 0
Custom Menus 33
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Apex Blue
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields Off
Switch to layout Off
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Off
OnLastWindowClose Off
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

Table Name
Statistics
Comments
Occurrences in Relationship Graph
SocketTest
6 fields defined, 0 record
SocketTest

Fields

Table Name: SocketTest - 6 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
Port Normal, Number Auto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      IP Normal, Text Auto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          Message Normal, Text Auto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              ListenPort Normal, Number Auto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Global
              • Repetitions: 1
              • Index Language: German
                  SendText Normal, Text Auto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Global
                  • Repetitions: 1
                  • Index Language: German
                      LastSocket Normal, Text Auto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Global
                      • Repetitions: 1
                      • Index Language: German

                          Layout Objects: SocketTest

                          Regular Fields

                          Field Name: SocketTest::Port
                          Field Properties Coordinates Field Format Field Behavior Quick Find
                          • Top: 72 pt
                          • Left: 563 pt
                          • Bottom: 86 pt
                          • Right: 612 pt
                          • Anchoring: Left, Top
                          Field Format:
                          • Edit Box
                          Field Behavior:
                          • Allow field to be entered: In Find mode, In Browse mode
                          • Touch keyboard type: System Default
                          • Go to next field using: Tab key
                          Yes

                          Field Name: SocketTest::IP
                          Field Properties Coordinates Field Format Field Behavior Quick Find
                          • Top: 72 pt
                          • Left: 437 pt
                          • Bottom: 86 pt
                          • Right: 558 pt
                          • Anchoring: Left, Top
                          Field Format:
                          • Edit Box
                          Field Behavior:
                          • Allow field to be entered: In Find mode, In Browse mode
                          • Touch keyboard type: System Default
                          • Go to next field using: Tab key
                          Yes

                          Field Name: SocketTest::Message
                          Field Properties Coordinates Field Format Field Behavior Quick Find
                          • Top: 72 pt
                          • Left: 137 pt
                          • Bottom: 86 pt
                          • Right: 390 pt
                          • Anchoring: Left, Top
                          Field Format:
                          • Edit Box
                          Field Behavior:
                          • Allow field to be entered: In Find mode, In Browse mode
                          • Touch keyboard type: System Default
                          • Go to next field using: Tab key
                          Yes

                          Field Name: SocketTest::ListenPort
                          Field Properties Coordinates Field Format Field Behavior Quick Find
                          • Top: 6 pt
                          • Left: 78 pt
                          • Bottom: 20 pt
                          • Right: 157 pt
                          • Anchoring: Left, Top
                          Field Format:
                          • Edit Box
                          Field Behavior:
                          • Allow field to be entered: In Find mode, In Browse mode
                          • Touch keyboard type: System Default
                          • Go to next field using: Tab key
                          No

                          Field Name: SocketTest::SendText
                          Field Properties Coordinates Field Format Field Behavior Quick Find
                          • Top: 12 pt
                          • Left: 426 pt
                          • Bottom: 26 pt
                          • Right: 679 pt
                          • Anchoring: Left, Top
                          Field Format:
                          • Edit Box
                          Field Behavior:
                          • Allow field to be entered: In Find mode, In Browse mode
                          • Touch keyboard type: System Default
                          • Go to next field using: Tab key
                          No

                          Field Name: SocketTest::LastSocket
                          Field Properties Coordinates Field Format Field Behavior Quick Find
                          • Top: 30 pt
                          • Left: 426 pt
                          • Bottom: 44 pt
                          • Right: 679 pt
                          • Anchoring: Left, Top
                          Field Format:
                          • Edit Box
                          Field Behavior:
                          • Allow field to be entered: In Find mode, In Browse mode
                          • Touch keyboard type: System Default
                          • Go to next field using: Tab key
                          No

                          Group Buttons

                          Button Properties Coordinates Script/Script Step
                            Type:
                          • Text: Create Socket and Listen
                            Additional Properties:
                          • Change to hand cursor over button
                          • Rectangular
                          • Top: 12 pt
                          • Left: 186 pt
                          • Bottom: 38 pt
                          • Right: 343 pt
                          • Anchoring: Left, Top
                          Perform Script [ “CreateSocket” ]

                          Scripts:


                          Button Properties Coordinates Script/Script Step
                            Type:
                          • Text: Send Text
                            Additional Properties:
                          • Change to hand cursor over button
                          • Rectangular
                          • Top: 12 pt
                          • Left: 702 pt
                          • Bottom: 37 pt
                          • Right: 787 pt
                          • Anchoring: Left, Top
                          Perform Script [ “SendText” ]

                          Scripts:


                          Script Hierarchy

                          CreateSocket
                          ReadSomething
                          NewConnection
                          SocketError
                          SendText

                          Next Script: [ReadSomething]
                          Script Name CreateSocket
                          Run script with full access privileges Off
                          Siri Shortcut Visible Off
                          Include In Menu Yes
                          Layouts that use this script
                          Scripts that use this script
                            Script Definition
                            Script Steps
                            • If [ not (GetAsNumber($$sock) > 0) ]
                            • Set Variable [ $$sock; Value:MBS("Socket.NewTCPSocket") ]
                            • If [ GetAsNumber($$sock) = 0 ]
                            • Show Custom Dialog [ Title: "Failed to create Socket"; Message: $$sock; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                            • 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; SocketTest::ListenPort) ]
                            • End If
                            Fields used in this script
                            Scripts used in this script
                              Layouts used in this script
                                Tables used in this script
                                Table occurrences used by this script
                                Custom Functions used by this script
                                  Custom menu set used by this script

                                    Previous Script: [CreateSocket] Next Script: [NewConnection]
                                    Script Name ReadSomething
                                    Run script with full access privileges Off
                                    Siri Shortcut Visible Off
                                    Include In Menu No
                                    Layouts that use this script
                                      Scripts that use this script
                                        Script Definition
                                        Script Steps
                                        • Set Variable [ $sock; Value:Get(ScriptParameter) ]
                                        • Set Variable [ $r; Value:MBS("Socket.Read"; $sock; 1500; "UTF-8") ]
                                        • If [ Left($r; 5) = "[MBS]" ]
                                        • Show Custom Dialog [ Title: "Error Reading"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                        • Else If [ Length($r) = 0 ]
                                        • // Show Custom Dialog [ Title: "Error Reading"; Message: "No data available."; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                        • Else [ ]
                                        • New Record/Request
                                        • Set Field [ SocketTest::Message; $r ]
                                        • Set Field [ SocketTest::IP; MBS("Socket.RemoteIP"; $sock) ]
                                        • Set Field [ SocketTest::Port; MBS("Socket.RemotePort"; $sock) ]
                                        • Commit Records/Requests [ No dialog ]
                                        • End If
                                        • // Set Variable [ $r; Value:MBS("Socket.Close"; $sock) ]
                                        Fields used in this script
                                        Scripts used in this script
                                          Layouts used in this script
                                            Tables used in this script
                                            Table occurrences used by this script
                                            Custom Functions used by this script
                                              Custom menu set used by this script

                                                Previous Script: [ReadSomething] Next Script: [SocketError]
                                                Script Name NewConnection
                                                Run script with full access privileges Off
                                                Siri Shortcut Visible Off
                                                Include In Menu No
                                                Layouts that use this script
                                                  Scripts that use this script
                                                    Script Definition
                                                    Script Steps
                                                    • Set Variable [ $sock; Value:Get(ScriptParameter) ]
                                                    • Set Variable [ $newSock; Value:MBS("Socket.AcceptNewConnection"; $sock) ]
                                                    • If [ GetAsNumber($newSock)>0 ]
                                                    • Set Variable [ $r; Value:MBS("Socket.SetErrorHandler"; $newsock; Get(FileName); "SocketError") ]
                                                    • Set Variable [ $r; Value:MBS("Socket.SetDataAvailableHandler"; $newsock; Get(FileName); "ReadSomething") ]
                                                    • Set Field [ SocketTest::LastSocket; $newSock ]
                                                    • End If
                                                    Fields used in this script
                                                    Scripts used in this script
                                                      Layouts used in this script
                                                        Tables used in this script
                                                        Table occurrences used by this script
                                                        Custom Functions used by this script
                                                          Custom menu set used by this script

                                                            Previous Script: [NewConnection] Next Script: [SendText]
                                                            Script Name SocketError
                                                            Run script with full access privileges Off
                                                            Siri Shortcut Visible Off
                                                            Include In Menu No
                                                            Layouts that use this script
                                                              Scripts that use this script
                                                                Script Definition
                                                                Script Steps
                                                                • Set Variable [ $sock; Value:Get(ScriptParameter) ]
                                                                • Show Custom Dialog [ Title: "Socket Error"; Message: "For Socket " & $sock; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                • Set Variable [ $r; Value:MBS("Socket.Close"; $sock) ]
                                                                • Set Variable [ $$sock; Value:"" ]
                                                                Fields used in this script
                                                                  Scripts used in this script
                                                                    Layouts used in this script
                                                                      Tables used in this script
                                                                        Table occurrences used by this script
                                                                          Custom Functions used by this script
                                                                            Custom menu set used by this script

                                                                              Previous Script: [SocketError]
                                                                              Script Name SendText
                                                                              Run script with full access privileges Off
                                                                              Siri Shortcut Visible Off
                                                                              Include In Menu Yes
                                                                              Layouts that use this script
                                                                              Scripts that use this script
                                                                                Script Definition
                                                                                Script Steps
                                                                                • Set Variable [ $r; Value:MBS( "Socket.Write"; SocketTest::LastSocket; SocketTest::SendText; "UTF8" ) ]
                                                                                Fields used in this script
                                                                                Scripts used in this script
                                                                                  Layouts used in this script
                                                                                    Tables used in this script
                                                                                    Table occurrences used by this script
                                                                                    Custom Functions used by this script
                                                                                      Custom menu set used by this script

                                                                                        Download example: Socket Test

                                                                                        Used functions: