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
Tables1
Relationships0
Layouts1
Scripts5
Value Lists0
Custom Functions0
Custom Menus33
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

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

Fields

Table Name: SocketTest - 6 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
PortNormal, NumberAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      IPNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          MessageNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              ListenPortNormal, NumberAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Global
              • Repetitions: 1
              • Index Language: German
                  SendTextNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Global
                  • Repetitions: 1
                  • Index Language: German
                      LastSocketNormal, TextAuto-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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesField FormatField BehaviorQuick 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 PropertiesCoordinatesScript/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 PropertiesCoordinatesScript/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 NameCreateSocket
                          Run script with full access privilegesOff
                          Include In MenuYes
                          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 NameReadSomething
                                    Run script with full access privilegesOff
                                    Include In MenuNo
                                    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 NameNewConnection
                                                Run script with full access privilegesOff
                                                Include In MenuNo
                                                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 NameSocketError
                                                            Run script with full access privilegesOff
                                                            Include In MenuNo
                                                            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 NameSendText
                                                                              Run script with full access privilegesOff
                                                                              Include In MenuYes
                                                                              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: