write ... to socket ... causing exception

I am writing a socket clipboard server to work around VNC’s inability to pass Unicode through its clipboard.
Very similar to the TIG, I have a C# app listening to a port and will either GET or SET the clipboard.
The idea is that Eggplant will open a socket to that port and either:
[list=1][]“GET” and wait for the end of response and then close
[
]"SET " and then close[/list:o]
I have opened up the SockClip’s listening port the SUT, and my listener works fine on the SUT in local-loopback mode.
I then try the following code from Eggplant:

setClip "foobar"

to handle setClip text
  set remoteClipServer to ServerID of ConnectionInfo() & ":9973"
  open socket remoteClipServer
  write "SET " & text to socket remoteClipServer
  close socket remoteClipServer
end setClip

The “write … to” results in a “NSFileHandleOperationException: Broken pipe” exception.

My C# socket server never sees any actual connection to “Accept” or read.

What is this error, and how can I debug what is going wrong?
When should I expect the first true connection to take place?
Does the connection persist between a write and the next read, or is each read/write/etc made w/ a different connection?
Is there something wrong w/ my above code?
Just curious: Are there any socket restrictions w/ the licensing model?

Pv

FYI, the exact exception text that is thrown is:


NSFileHandleOperationException *** -[NSConcreteFileHandle writeData:]: Broken pipe

Pv

To verify that you can connect from an Eggplant script to a socket on the remote machine, the simplest test is to try connecting to the VNC server that’s running there.

Here’s a little script that will connect to a VNC server running locally on the Eggplant machine:

put "localhost:5900" into vncSocket
open socket vncSocket
read from socket vncSocket for 12 chars
put it
close socket vncSocket

When run (if you are running OSXvnc on port 5900 on the Eggplant machine) you should see “RFB 003.008” or something similar depending on the server version. To test a connection to the remote machine, change “localhost:5900” to the IP address of your remote machine and its VNC port number. This will verify that socket connections are working between the two machines.

If that works, but you can’t connect to your other server, the most likely cause is a firewall restriction on the machine. Make sure that the port is open through the firewall, and that the socket is correctly open and advertised for accepting external connections.

To answer your other questions:

When should I expect the first true connection to take place?
The connection should occur when the script opens the socket.

Does the connection persist between a write and the next read, or is each read/write/etc made w/ a different connection?
A socket connection should persist until it is closed, either by a “close socket” command in the script, or by the remote server process.

Is there something wrong w/ my above code?
No, your code looks perfect.

Just curious: Are there any socket restrictions w/ the licensing model?
No, socket support is a standard part of SenseTalk – if you can run Eggplant, you should be able to use sockets.