Search the Community
Showing results for tags 'named pipes'.
-
Hi, just for reference. you can control the streamlabs OBS client via Named Pipes like so: Local $sMessage = '{"jsonrpc": "2.0","id": 1,"method": "toggleRecording","params": {"resource": "StreamingService","args": []}}' $handle = FileOpen("\\.\pipe\slobs", 2) FileWriteLine($handle, $sMessage) FileClose($handle) the api can be found here: https://stream-labs.github.io/streamlabs-obs-api-docs/docs/index.html
-
IPC_IO.AU3 I am in the need for a simple synchronous Client/Server communication. I found several examples and references to various kinds of Inter-Process Communications such as TCP, Named Pipes, Mail Slots, Shared Memory, Memory Mapped Files, and simple Files. I wanted to see what the best solutions would be. I began developing a library and slowly began adding each of the IPC methods and ended up with a library with a very simple synchronous “ASCII” API where the application can choose which method to use at startup. For the Server side, a Server app must initialize communication by calling: Func InitConnection($cType = $cDefaultType, $ResourceName = "", $bBlock = $cDefaultBlocking, $fSleepFunc = "", $iBufSize = $DEFAULT_BUFSIZE) The optional arguments allow the app to specify the connection type (such as: $cNamedPipe, $cFile, $cTCP, $cSharedMem, $cMailSlot), a value for the resource name (such as the file, named pipe name, TCP port number, etc.), the communication buffer size, and a callback function for when the “read” is waiting for data. A “File Descriptor” is returned and must be used in the future API calls. The Server side must then call: Func StartConnection($iFD) This call waits for a Client to connect. The Server then calls: Func ReadData($iFD, ByRef $sData) To read a Request from the Client and then calls: Func WriteData($iFD, ByRef $sData) To send the reply back to the Client. When communication with the Client is done, the Server app will call: Func StopConnection($iFD) When the Server app is done with the communications it will call: Func EndConnection($iFD) For the Client side, a Client app must open the communication by calling: Func OpenConnection($cType = $cDefaultType, $ResourceName = "", $bBlock = $cDefaultBlocking, $fSleepFunc = "", $iBufSize = $DEFAULT_BUFSIZE) The optional arguments allow the app to specify the connection type (such as: $cNamedPipe, $cFile, $cTCP, $cSharedMem, $cMailSlot), a value for the resource name (such as the file, named pipe name, TCP port number, etc.), the communication buffer size, and a callback function for when the “read” is waiting for data. A “File Descriptor” is returned and must be used in the future API calls. The Client side then send a request to the Server app by calling: Func WriteData($iFD, ByRef $sData) To read a Response from the Server by calling: Func ReadData($iFD, ByRef $sData) To end the connection to the Server by calling: Func CloseConnection($iFD) Within the IPC_IO.AU3 library, each IPC method is ether: · “stream” based where data is read/written by calling _WinAPI_ReadFile/TCPRecv or _WinAPI_WriteFile/ TCPSend · “direct” based for Shared memory where the Client reads the data directly from the Server App’s memory and the Server directly reads the Client App’s memory In processing a request, the “ReadData” process starts by checking if data is ready to be read by calling the routine: “ReadStart”, then it reads in the size of the request by calling “ReadSize”, it then reads in the Ascii Request by calling “ReadBuffer”, then the sequence is completed by calling “ReadEnd”. The Write Process follows the same sequence with “WriteData” calling “WriteStart”, “WriteSize”, “WriteBuffer”, “WriteEnd”. Results My testing showed that the performance of sending and receiving of a 10k file took: · "Shared Memory" was the fastest, at 0.007468 Sec · “Named Pipes” at 0.015954 · “Mail Slots” at 0.016427 · “File Based” at 0.270287 · “TCP” at 0.994884 IPC_IO.au3 Client.au3 Server.au3
- 2 replies
-
- ipc
- named pipes
-
(and 3 more)
Tagged with: