Project

General

Profile

dmsem.py fails to open local connection on K2 computer

Added by Gregory Alushin over 9 years ago

Hi Anchi et al.-

I came back after being out of town excited to fix my silly pixel size error (oops). However, some sort of problem had occurred which resulted in me having to restart our K2 and K2 computer.

After doing so, Leginon was unable to load camera settings or take images, although it was still capable of connecting to the K2 computer client.

The issue appears to be with dmsem.py making a connection on the local computer, as the following test fails:

import pyscope.dmsem
k=pyscope.dmsem.GatanK2Counting()

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
k=pyscope.dmsem.GatanK2Counting()
File "C:\Python27\lib\site-packages\pyscope\dmsem.py", line 50, in __init__
self.camera = connect()
File "C:\Python27\lib\site-packages\pyscope\dmsem.py", line 35, in connect
gatansocket.myGS = gatansocket.GatanSocket()
File "C:\Python27\lib\site-packages\pyscope\gatansocket.py", line 139, in __init__
self.connect()
File "C:\Python27\lib\site-packages\pyscope\gatansocket.py", line 175, in connect
self.sock = socket.create_connection(('127.0.0.1',self.port))
File "C:\Python27\lib\socket.py", line 571, in create_connection
raise err
error: [Errno 10061] No connection could be made because the target machine actively refused it

As best I can tell the firewall on the K2 computer is entirely disabled, and it was working correctly before restarting the machine. It seems quite strange that it would still accept network connections (i.e. test1.py test2.py work), but not local connections. The SERIALEMCCD_PORT environment variable is set to 53333, and is read correctly by os.environ.

I was wondering if you had ever seen something similar, and if it is indeed some sort of security setting on the K2 windows computer...

Thanks,
-Greg


Replies (2)

RE: dmsem.py fails to open local connection on K2 computer - Added by Gregory Alushin over 9 years ago

OK managed to fix this one ourselves: apparently dmsem.py was fighting another process that randomly requested that port upon restarting the computer.

If anyone else encounters this issue, the fix is to change the port.

-Greg

RE: dmsem.py fails to open local connection on K2 computer - Added by Anchi Cheng almost 9 years ago

For those running into the same problem:

There is a way to close socket ports without restarting, but you need to be sure that which port needs to be closed. In this case, it is safe to assume that you need to close the one specified by SERIALEMCCD_PORT environment variable. I have tried the program CurrPorts.exe and it is a good one with gui as well as command line options. Search the internet to get it.

CurrPorts also shows which process is using the port. Therefore, if you run into the problem, you can report back to us where this problem come from.

Thanks from Leginon team.

    (1-2/2)