Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages
Started by Ramy
Thu, 20 Jul 2006 16:49
Strange 'WriteFile' Freezing problem
Author: Ramy
Date: Thu, 20 Jul 2006 16:49
Date: Thu, 20 Jul 2006 16:49
17 lines
1313 bytes
1313 bytes
Please Help, I'm having a very strange problem, sometimes my application is "Freezing" in the following command - WriteFile( hndl, TxBuff, MessageLen, &written, NULL ); (sending data through RS-232 port) sometimes it's happening after 15 seconds, and sometimes after 2 minutes.... I checked the command parameters and they all looks OK, I compared the command parameters (hndl, TxBuff...) when the command works OK, and when it's freezing, and they looks exactly the same..... what can be the problem ?? Thanks! Ramy.
Re: Strange 'WriteFile' Freezing problem
Author: Remy Lebeau (TeamB)
Date: Thu, 20 Jul 2006 19:12
Date: Thu, 20 Jul 2006 19:12
17 lines
1446 bytes
1446 bytes
"Ramy" <Ramy@NoMail.com> wrote in message news:44bfb418$1@newsgroups.borland.com... > Please Help, I'm having a very strange problem, sometimes > my application is "Freezing" in the following command - > > WriteFile( hndl, TxBuff, MessageLen, &written, NULL ); > > (sending data through RS-232 port) How much data are you actually sending? What kind of device is on the other end of the port? What kind of timeouts are you using? Have you considered using Overlapped I/O with the port yet? Gambit
Re: Strange 'WriteFile' Freezing problem
Author: Ramy
Date: Sun, 23 Jul 2006 11:24
Date: Sun, 23 Jul 2006 11:24
28 lines
1607 bytes
1607 bytes
Hi, the timeouts that I use are the following - read_timeout.ReadIntervalTimeout = 0; read_timeout.ReadTotalTimeoutMultiplier = 150; read_timeout.ReadTotalTimeoutConstant = 150; read_timeout.WriteTotalTimeoutMultiplier = 0; read_timeout.WriteTotalTimeoutConstant = 150; I asked the WriteFile command to send 8 bytes, and the size of my TxBuff[] is 250 bytes. Any Idea ? "using Overlapped I/O with the port" What does it do? do you have an example? is it complicate? Thanks! >How much data are you actually sending? What kind of device is on the other >end of the port? What kind of timeouts are you using? Have you considered >using Overlapped I/O with the port yet? > >Gambit
Re: Strange 'WriteFile' Freezing problem
Author: Ramy Ramy
Date: Sun, 23 Jul 2006 11:26
Date: Sun, 23 Jul 2006 11:26
8 lines
1154 bytes
1154 bytes
Sorry the timeouts are - read_timeout.ReadIntervalTimeout = 0; read_timeout.ReadTotalTimeoutMultiplier = 0; read_timeout.ReadTotalTimeoutConstant = 150; read_timeout.WriteTotalTimeoutMultiplier = 0; read_timeout.WriteTotalTimeoutConstant = 150;
Re: Strange 'WriteFile' Freezing problem
Author: Remy Lebeau (TeamB)
Date: Sun, 23 Jul 2006 19:00
Date: Sun, 23 Jul 2006 19:00
39 lines
2097 bytes
2097 bytes
"Ramy" <Ramy@NoMail.com> wrote in message
news:44c35c6a$1@newsgroups.borland.com...
> Hi, the timeouts that I use are the following -
These are the timeouts that I use:
read_timeout.ReadIntervalTimeout = 0;
read_timeout.ReadTotalTimeoutMultiplier = 5;
read_timeout.ReadTotalTimeoutConstant = 5000;
read_timeout.WriteTotalTimeoutMultiplier = 5;
read_timeout.WriteTotalTimeoutConstant = 1000;
> I asked the WriteFile command to send 8 bytes, and the size of my TxBuff[]
is 250 bytes.
What buffer sizes are you specifying in SetupComm()? What DBC values are
you specifying in SetCommState()?
> Any Idea ?
You did not answer my earlier question:
"What kind of device is on the other end of the port?
If the device is having problems reading, and you are using any kind of flow
control, that might explain why your writing is freezing periodically.
> "using Overlapped I/O with the port"
>
> What does it do? do you have an example? is it complicate?
Overlapped Operations
http://msdn.microsoft.com/library/en-us/devio/base/overlapped_operations.asp
Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads