This plugin provides 2 examples of a TCP/IP server implementation
for Softimage. The first example is a C# server which manages
client connections asynchronously and can execute requests received
from client connections.
The XSIClientSample command-line application can be used for
sending requests to the Softimage server.
XSIClientSample.exe "log|my message" -> logs "my message" in the history window. XSIClientSample.exe "script|c:\\temp\\test.vbs" -> executes the test.vbs script in Softimage (any Softimage script language can be used)Note: The above examples work if the XSIServer is connected on the localhost (127.0.0.1) on port 10000.
XSIClientSample.exe "log|Send to 172.24.40.132 on port 50010" "172.24.40.132" 50010 XSIClientSample.exe "script|c:\\temp\\test.vbs" "172.24.40.126" 50010
The second example is a python TCP server which also manage client connections asynchronously. The tcpclient.py example can be used for sending requests to the TCP server.
##tcpclient.py from socket import * HOST = 'localhost' PORT = 5007 #our port from before ADDR = (HOST,PORT) BUFSIZE = 4096 cli = socket( AF_INET,SOCK_STREAM) cli.connect((ADDR)) cli.send('xyz_request:Torus') data = cli.recv(1024) print 'request result %s' % (data) cli.close()
Location | |
Files |
XSIServer.cs
XSITCP.cs
XSIServiceProvider.cs
XSIHelpers.cs
main.cs
si_tcp_server.py
tcpclient.py
|
To install the example
Connect to the Softimage SDK workgroup at %XSISDK_ROOT%\examples\workgroup.
To view the help page for an example
To run the C# TCP Server Example
Open a Softimage command prompt, and type the following:
XSIClientSample.exe "log|Message sent from XSIClientSample"
To run the python TCP Server Example
Open a Softimage command prompt, and type the following:
python.exe tcpclient.py
Softimage SDK includes a compiled version of XSIServer and XSIClientSample. If you want to modify the code, you can rebuild the example by following these instructions.
To build the example on Windows
Open an Softimage command prompt, and type devenv to start Visual Studio .NET.
Starting Visual Studio .NET from an Softimage command prompt ensures that environment variables such as XSI_HOME are set (otherwise you'll get build and link errors).
Tip To load the XSIServer project from the command line, type:
devenv cssrc\XSIServer.csproj
This example uses the following keywords:
C#, TCP/IP, RegisterCommand, RegisterProperty, RegisterMenu, RegisterTimerEvent.