I hope it's ok for me to place an IronPython question in this forum(?).
I am running IronPython 1.1.2 and Python 2.5.
OS is Windows XP SP3.
Currently I'm developing a lightweight test framework. In short, there are two scripts that control one hardware device each. The hardware devices are communicating wirelessly. I am using IronPython because I am then able to use some needed .NET libraries seamlessly.
One functionality I need in the scripts is a way of synchronizing them with each other. The scripts are running in separate threads, so I need interprocess communication. I also need the synchronization to be able to timeout, to avoid the script from hanging indefinitely.
I have found that sockets would fit my needs well. One script binds and listens to a socket, and the other script connects to the same socket, allowing them to exchange messages.
Now, my problem is that I am not able to make the timeout of the socket to work in IronPython. When I test the same in Python it works like a charm. Here is the isolated code for demonstrating the problem:
Expand|Select|Wrap|Line Numbers
- from socket import *
- s = socket(AF_INET, SOCK_STREAM)
- s.bind(('', 8888))
- s.listen(5)
- s.settimeout(2)
- client, addr = s.accept()
Is the implementation of socket in IronPython lacking the ability of timeout?
(Suggestions to other approaches to my problem would also be greatly appreciated.)