BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Strange 'WriteFile' Freezing problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Ramy
Guest





PostPosted: Thu Jul 20, 2006 9:49 pm    Post subject: Strange 'WriteFile' Freezing problem Reply with quote



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.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Jul 21, 2006 12:12 am    Post subject: Re: Strange 'WriteFile' Freezing problem Reply with quote



"Ramy" <Ramy (AT) NoMail (DOT) com> wrote in message
news:44bfb418$1 (AT) newsgroups (DOT) borland.com...

Quote:
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
Back to top
Ramy
Guest





PostPosted: Sun Jul 23, 2006 4:24 pm    Post subject: Re: Strange 'WriteFile' Freezing problem Reply with quote



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!



Quote:
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
Back to top
Guest






PostPosted: Sun Jul 23, 2006 4:26 pm    Post subject: Re: Strange 'WriteFile' Freezing problem Reply with quote

Sorry the timeouts are -

read_timeout.ReadIntervalTimeout = 0;
read_timeout.ReadTotalTimeoutMultiplier = 0;
read_timeout.ReadTotalTimeoutConstant = 150;
read_timeout.WriteTotalTimeoutMultiplier = 0;
read_timeout.WriteTotalTimeoutConstant = 150;
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Jul 24, 2006 12:00 am    Post subject: Re: Strange 'WriteFile' Freezing problem Reply with quote

"Ramy" <Ramy (AT) NoMail (DOT) com> wrote in message
news:44c35c6a$1 (AT) newsgroups (DOT) borland.com...

Quote:
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;

Quote:
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()?

Quote:
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.

Quote:
"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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.