Re: Socket read problems

2010-10-08 Thread Len Morgan
The two handlers are right next to each other in the card script. You may be right about getting another error like socketError or socketClose that overrides the need for socketTimeout although I would think any socket timeout would also constitute a socket error wouldn't it? If so, why the

Re: Socket read problems

2010-10-08 Thread Dar Scott
I still haven't remembered what is weird about socketTimeout. Perhaps you don't get it if you get socketClose or socketError. (When debugging TCP, I use handlers for all.) Is your socketTimeout handler in the right path? (An example situation is when your socketTimeout handler is in the c

Re: Socket read problems

2010-10-08 Thread Len Morgan
Not according to the documentation. And I didn't start off using the "with message" form. In fact, I never did get around to even trying that once I discovered that was the one that was making the mistake (i.e., trying to read more bytes than were there). len morgan On 10/8/2010 1:29 PM,

Re: Socket read problems

2010-10-08 Thread Dar Scott
On Oct 8, 2010, at 12:02 PM, Len Morgan wrote: It still bothers me though that I never got the socketTimeout message even though that's exactly what was happening. I have a vague memory of strange things with this. I wonder if you don't get the message if you don't use 'with message' in t

Re: Socket read problems

2010-10-08 Thread Len Morgan
Dar, As it turns out, (and much to my embarrassment) you were close on your first response: I was trying to read more bytes than were actually there. The ModBus/TCP spec actually sends two length items. One is the header + data length and the other is the data length only. What I was doin

Re: Socket read problems

2010-10-08 Thread Dar Scott
On Oct 8, 2010, at 5:29 AM, Len Morgan wrote: I wish it was that simple but the length of the message is only in one byte so it's pretty hard to swap. Yeah, I guess the high byte is always zero. I never use read by number of bytes. It is not that I have seen problems with it, I just beca

Re: Socket read problems

2010-10-08 Thread Alex Tweedly
No good suggestion - but you might try multiple reads, each of one byte to see how many you get. -- Alex. On 08/10/2010 12:29, Len Morgan wrote: Dar, I wish it was that simple but the length of the message is only in one byte so it's pretty hard to swap. For test purposes, I have scrollin

Re: Socket read problems

2010-10-08 Thread Len Morgan
Dar, I wish it was that simple but the length of the message is only in one byte so it's pretty hard to swap. For test purposes, I have scrolling field where I print the progress of the conversation and I am displaying the correct length. Also, I've got WireShark on the line so I can look

Re: Socket read problems

2010-10-07 Thread Dar Scott
Could you have gotten the two length bytes swapped and are asking for way too many bytes? Dar Scott On Oct 7, 2010, at 6:22 PM, Len Morgan wrote: I'm trying to read data from a MODBus/TCP controller and having some issues with the timing of the read command. I request a block of registe

Socket read problems

2010-10-07 Thread Len Morgan
I'm trying to read data from a MODBus/TCP controller and having some issues with the timing of the read command. I request a block of registers from the slave and it returns the requested bytes and header just fine and very quickly. In order to read everything right, I have to first read the