Telnet connect using SOCKIT

Hi,
I have been trying to establish text based interface in Igor with "Zurich Instruments Lock In" through TCP/IP sockets using a telnet connection type. I found an XOP file for sockit on this forum and have placed that in my igor extension folder. However the help file does not compile for some reason so i am unable to understand the flags in commands (e.g. sockitopenconnection).

I need to setup following options, which can be seen easily seen in the Telnet client Putty.

Terminal category, Implicit CR in every LF - set
Session category, Host Name - localhost
Session category,Port - 8005
Session category, Connection type - Telnet

Does someone know if it is possible to incorporate such settings. if yes, how?
Thanks a lot for any help,

------------------------------------
Vishal
Graduate Student
Department of Physics
Uni Basel, Switzerland
Did you put the SOCKIT Help.ihf file in the IGOR extensions folder as well? You really need it to understand what's going on. (It compiles on my computer). What happens when you double click the help file?

Briefly:

make/t buf
variable sockitID
SOCKITopenconnection sockitID, "localhost", 8005, buf
//you have to add in the CRLF yourself.
SOCKITsendmsg sockitID, "mymessage" + "\r\n"
Yes the help file is also in the extension folder. When i try to access help, there pops up a message saying that the "help file needs to be complied". Once i click ok, two more messages pop up saying that "file is open for reading only" and Pressing ok just aborts the compilation. I attach two snapshots.
error1.png error2.png
sorry for multiple messages.
I am not able to open a connection with my instrument using sockitopenconnection socketID, host, port, buf
and keep getting error in the command window "SOCKIT err: socket not connected -1"
I tried some of the examples from this forum, e.g. connect to www.example.com or www.wavemetrics.com at port 80 and these work nicely.
Since, I can access the port using Putty, this all makes me confused if there is some problem with the igor XOP settings. Does it always assume a telnet connection type for opening sockets?

thanks again
Vishal
vishalran wrote:
sorry for multiple messages.
I am not able to open a connection with my instrument using sockitopenconnection socketID, host, port, buf
and keep getting error in the command window "SOCKIT err: socket not connected -1"
I tried some of the examples from this forum, e.g. connect to www.example.com or www.wavemetrics.com at port 80 and these work nicely.
Since, I can access the port using Putty, this all makes me confused if there is some problem with the igor XOP settings. Does it always assume a telnet connection type for opening sockets?

thanks again
Vishal


SOCKIT simply opens a TCP connection to the host/port of choice. http://en.wikipedia.org/wiki/Berkeley_sockets You should be able to do what you do with telnet with SOCKIT.
Just to confirm, can you connect using Putty? What hostname do you use to connect?
i use localhost as the hostname and port number 8005,
i also need to choose telnet as the connection type. it does not work for other options in putty.

thanks,
Vishal
Quote:
Yes the help file is also in the extension folder. When i try to access help, there pops up a message saying that the "help file needs to be complied". Once i click ok, two more messages pop up saying that "file is open for reading only"


Possibly you have put the XOP and the help file in the Igor Extensions folder inside the Igor Pro Folder. This is the wrong place to put it. Instead put it in the Igor Extension folder inside the Igor Pro User Files folder. Then restart Igor.

For details execute:
DisplayHelpTopic "Special Folders"

I moved the files to the Igor pro user file folder and now the help file works. thank you!

andyfaff wrote:
Just to confirm, can you connect using Putty? What hostname do you use to connect?


hi andy,
I can connect to my instrument through Putty using "localhost" as the hostname and port number 8005. But I am still unable to communicate using igor (SOCKIT command) and keep getting error messages of unsuccessful connection.

thanks for any suggestions,
Vishal
Unfortunately, without the equipment in front of me I'm not sure if I can help you any further. Have you tried connecting with something like Python? Alternatively, I wonder if your firewall could be blocking the connection (although it's on localhost)?

Note that SOCKIT is just raw TCP packets. This means it's not totally the same as telnet. Telnet also has control characters.

I recommend using a program called wireshark (http://www.wireshark.org/). This enables you to inspect all traffic on your network card. Set this program up so it just looks at the traffic going to/from this equipment with Putty. Then compare to the communication with SOCKIT. If the two aren't the same then this will tell you something. You can then alter the messages sent by sockit. I have used wireshark before and it's quite easy to use.

A.
I setup an echo server on port 9001 on localhost. I used telnet to connect to this server. Then I used wireshark to capture all traffic on localhost. I sent two messages, a (61) then q (71). They are then followed by 0d 0a, which is CRLF.
You can see them echoed back.

it turns out that i am just a Noob. I tried sockitopenconnection using "127.0.0.1" instead of "localhost" and it worked out just fine.

thanks for all your help and sorry for the hassle.
cheers,
Vishal
Ok, it was a DNS issue then.

I've just been searching for this. It seems that on Windows 7 localhost resolves to the IPv6 address (::1) by default rather than the IPv4 one (127.0.0.1). Glad you solved your problem. I wouldn't classify that as a noob problem, but you probably should've tried 127.0.0.1 at some point.

For future information you can use the nslookup program to see what IP address a host resolves to. Try using the following from the Windows command line:
nslookup localhost

What happens?
andyfaff wrote:
Ok, it was a DNS issue then.

I've just been searching for this. It seems that on Windows 7 localhost resolves to the IPv6 address (::1) by default rather than the IPv4 one (127.0.0.1). Glad you solved your problem. I wouldn't classify that as a noob problem, but you probably should've tried 127.0.0.1 at some point.

For future information you can use the nslookup program to see what IP address a host resolves to. Try using the following from the Windows command line:
nslookup localhost

What happens?


it spits out the server names and addresses
name: localhost.unibas.ch
address: 127.0.0.1