PVA-3000 Reference Manual
December 2, 2019 Sifos Technologies
6.3.2. TCP Socket Server
PowerShell PSA can be operated as a TCP Socket Server with ability to receive commands, process commands, and
transmit responses to a TCP socket client operating on the same host computer or perhaps elsewhere on the network.
Any external application capable of input/output via TCP sockets can take advantage of this inter-process
communication capability. A key benefit of the Socket Server is that all PVA commands and queries available to
PowerShell PSA become available to any external application that can output lines (ASCII strings) to a socket
connection and read lines back from that same socket connection.
In order to maintain robustness, client applications are required to pair a socket read operation with every socket write
operation, even if PowerShell PSA is not returning any information. This provides a command-by-command
handshake to assure remotely furnished commands were properly processed.
PSA software includes an embedded command to initiate the TCP Socket Server and a separate command to terminate
that server. The TCP Socket Server may run either in PowerShell Tcl or PowerShell Wish.
< tcp_port> <-space | -semicolon | -grave | -caret >
COMMAND_OK
|
RESPONSE +
delimited ascii
string
|
PowerShell_ERROR
+ delimited ascii
string
This command puts PowerShell PSA into a TCP Socket Server mode where
it will automatically receive, process, and respond to PSA commands and
queries from a remote client application, either on same host or elsewhere on
the network. Query and utility results are passed back through the socket
I/O as single lines with user-specified delimiters between elements.
Commands will respond with either COMMAND_OK or with
PowerShell_ERROR Error Message”. Queries will respond with either
RESPONSE data or with PowerShell error message. Special client
command quit will terminate PowerShell, psa_server_off will prevent new
server connections, show port will return current slot,port value, show psa
will return currently connected PSA address, and show error will return the
most recent error message from PowerShell.
tcp_port TCP port to be assigned to socket server. Default value is 6900.
Range is 1024 to 9999.
-space Specifies that all response data elements will be separated by a
space. Line will terminate with a line feed. This is the default mode.
-semicolon Specifies that all response data elements will be separated by a
semicolon (;). Lines will terminate with a semicolon, then a line feed.
-grave Specifies that all response data elements will be separated by a
grave accent (`).Lines will terminate with a grave accent, then a line feed.
-caret Specifies that all response data elements will be separated by a caret
(^).Lines will terminate with a caret, then a line feed.
Discontinues PowerShell PSA command server such that it will not accept
any new connections.
The TCP Socket Interface method, including an example, is discussed in greater detail in the Sifos Technologies
application note PowerShell PSA - Remote Access Methods (PowerShell PSA - Remote Access Methods.pdf).
Additionally, application notes with specific examples of the TCP Socket Interface are available for the following
application environments:
Microsoft Visual Basic 6 (PowerShell Socket Client - Visual Basic 6 Application.pdf)
National Instruments LabView (PowerShell Socket Client - LabView Application.pdf)