« Reducing plugin footp… | Home | MBS Xojo Plugins, ver… »

Socket changes for MBS FileMaker Plugin

We adjust our Socket functions for next pre-release to allow better error handling. Do you use those?

The changes are that we now better return you the lower level socket errors:

If the socket is broken due to being disconnected, we now return an error instead of zero for Socket.AvailableBytes or empty text for reading. Writing no longer returns -1 in case of error, but the error code and message. Please be aware that if you checked with MBS("IsError") already (as recommended) for all MBS calls, you would catch the error state. But in case you compare results to -1 for write, this will fail in future as you now have an error message. GetAsText() for the error message could take just the error number. You may also use Socket.LastError to get the OS specific error code.

We hope you enjoy the Socket functions!

Talking of Socket functions, for most people it is better to use CURL functions instead. If you use CURL.SetOptionConnectOnly to turn a CURL session to connect only, you can then use the socket to do whatever you like. Until you close via CURL.Cleanup, you can use CURL.ReceiveData, CURL.ReceiveText, CURL.SendData and CURL.SendText functions to read/write data on the sockets. As CURL can do proper SSL, timeouts and proxy tunneling, you benefit from those additional features.

On the way we got another nice feature: Trace.SetServerLogPath function. This allows you to tell the plugin to put trace files on server in a folder and give each individual thread executing scripts it's own log file. So if you run 100 PSoS scripts in parallel, you now can have those 100 files to see each script doing it's work. But be aware that FileMaker Server reuses threads and the logs append the files, so when a script is done, the log file gets reused for another script.
31 08 20 - 18:52