« Xojo Developer Confer… | Home | MBS Workshop in Hambu… »

New Windows Pipe class for Xojo

Yesterday we got a call from a good client asking for a IPCSocket replacement in Xojo. The existing IPCSocket class in Xojo didn't work for them when using a Windows service.

So we started yesterday evening with the development of our new WindowsPipeMBS class. The class can work client or server side, so you can either create a pipe or connect to one. When the connection is made, we fire the Connected event and in case the pipe breaks, we fire the PipeBroken event. There you can close the pipe and create or connect a new pipe.

For a pipe you can define the name which is used to refer to the pipe. You define the buffer size for the input and output buffers. And when using applications running in different user accounts, we can allow other users to connect. This allows especially a service to be connected by a normal user application.

To send data, we got a Write method, which takes either MemoryBlock or String to send. When data arrives, the DataAvailable event is triggered. You can check the given parameters there or use the BytesAvailable property to know how much data is there. With Peek function, you can look at the data you need or use PeekAll at all the data in the incoming buffer. With Read or RealAll you can read the content of the buffer and remove it from there.

The pipe can be run in message mode. Default is to run in byte mode, which means you read and write just bytes. When using message mode, each call to Write creates a message. When you read on the other side, you get each message as one block. So in data available handler you get a call for each message with MessageBytesAvailable property showing the size. When you call ReadAll, you get just the content of message, even if more data is in the buffer. Once a message is read, you can read the next message. Message mode is great, when your payload is for example JSON data.

We hope you enjoy the new class and our customer is happy as they got the desired class in less than 24h.
The WindowsPipeMBS class will be part of the MBS Xojo Plugins 19.5.
26 09 19 - 17:04