|
TCP/IP Communications - Sample Projects PingPong_TCP_Server/Client.ptp |
|
|
The project files PingPong_TCP_Server.ptp and PingPong_TCP_Client.ptp in the \ScriptSamples\Network folder demonstrate how to use Docklight Scripting as a TCP server or TCP client and exchange data.
The samples show how a server and a client can be run on the same computer using the LOCALHOST network name, which always refers to the computer Docklight is running on.
Getting started
The 'client' Docklight now connects to the 'server' Docklight, and data is exchanged as if the two Docklight instances were connected by a serial null-modem cable.
The communication window on the client side now displays the following messages:
3/9/2009 17:29:24.192 [TX] - ----o Ping 3/9/2009 17:29:24.218 [RX] - o---- Pong "Pong" received 3/9/2009 17:29:24.221 [TX] - ----o Ping 3/9/2009 17:29:24.249 [RX] - o---- Pong "Pong" received 3/9/2009 17:29:24.254 [TX] - ----o Ping 3/9/2009 17:29:24.281 [RX] - o---- Pong "Pong" received 3/9/2009 17:29:24.283 [TX] - ----o Ping 3/9/2009 17:29:24.312 [RX] - o---- Pong "Pong" received ...
On the server side, you will see something like this:
3/9/2009 17:29:24.203 [RX] - ----o Ping "Ping" received 3/9/2009 17:29:24.206 [TX] - o---- Pong 3/9/2009 17:29:24.235 [RX] - ----o Ping "Ping" received 3/9/2009 17:29:24.238 [TX] - o---- Pong 3/9/2009 17:29:24.266 [RX] - ----o Ping "Ping" received 3/9/2009 17:29:24.268 [TX] - o---- Pong 3/9/2009 17:29:24.298 [RX] - ----o Ping "Ping" received 3/9/2009 17:29:24.301 [TX] - o---- Pong ... |