comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Non-blocking socket
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Non-blocking socket [message #86409] Tue, 05 November 2013 14:50 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
well, working on sockets is not my thing, but I can't get around the fact that IDL "waits" for an answer and this is not the case elsewhere.
Let me explain...
I open a socket this way:

SOCKET, Unit, IP, Port, $
CONNECT_TIMEOUT=Connect_Timeout, $
READ_TIMEOUT=Read_Timeout, $
WRITE_TIMEOUT=self.Write_Timeout, $
Error=RetError, /GET_LUN

The IP is a local one and points to another software on the pc (Win 7-64 bits) that acts as socket server. The timeouts are set to 5, 1 and 1 seconds for connection, read and write, respectively.

Now when I attempt to read a simple string (a device name) in a loop of 100, it takes roughly 100 seconds.
To read I use something like:

Value = ''
WRITEU, Unit, 'cmd '+STRTRIM(I,2)
READF, Unit, Value

I could not get around this by changing the timeouts or removing them (even worst!). So, what I did is take some time to learn to do this in another language and find out if the socket server is slowing me down or the way the socket is implemented in IDL. Well I tried this in python and after quite some pains and fiddling with a language I don't know about, I managed to get the job done in 0.007 seconds (1.5 min in IDL).
Now I know very well, that the problem is in the way the socket command is implemented... is there any way to get around this without "waiting" in IDL and read directly byte/char data in while loops?

Maybe not an elegant solution, but that's how I see it done elsewhere.

Many thanks,
Helder
[Message index]
 
Read Message
Read Message
Previous Topic: convolve mystery
Next Topic: Overplot grid

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:39:27 PDT 2025

Total time taken to generate the page: 0.00380 seconds