Hi -
I'm using overlapped i/o on Windows 98 and on XP
and am getting different results.
Here's the code snippet:
// read the command id and the message length
BOOL rc;
ResetEvent(m_Se rialRecvOL.hEve nt);
rc = ReadFile(m_hSer ialPort, &buf[1], 6, pBytesRead,
(LPOVERLAPPED) &m_SerialRecvOL );
if (!rc && GetLastError() == ERROR_IO_PENDIN G) {
waitStatus = WaitForSingleOb ject(
m_SerialRecvOL. hEvent, 5000);
if (status == WAIT_OBJECT_0){
GetOverlappedRe sult(m_hSerialP ort,
&m_SerialRecvOL , pBytesRead, FALSE);
rc = TRUE;
}
}
On windows 98, ReadFile returns with rc = false
and pBytesRead = 0 and then the operation is
successfully completed later and GetOverlappedRe sult
fills in pBytesRead with 6 to indicate 6 bytes read.
On XP, ReadFile returns right away with rc = true
and *pBytesRead = 3. I don't get all my data (6 bytes),
yet the call to ReadFile indicates that it's done
even though it only reads 3 bytes.
Can anyone tell me what I'm missing here?
Thanks,
Donna Rigas
ioline corporation 1 1822
Hi,
I think this is normal for a serial port. You need to keep reading until no
more data arrives, or you have the data you are expecting. Not sure
specifically why W98 and XP behaviour differs but this is hardly surprising
as XP is a NT derivative so completely different underlying code.
PS This is not really a suitable NG for this subject
Cheers
Doug Forster
"donna rigas" <an*******@disc ussions.microso ft.com> wrote in message
news:0c******** *************** *****@phx.gbl.. . Hi -
I'm using overlapped i/o on Windows 98 and on XP and am getting different results.
Here's the code snippet:
// read the command id and the message length BOOL rc; ResetEvent(m_Se rialRecvOL.hEve nt); rc = ReadFile(m_hSer ialPort, &buf[1], 6, pBytesRead, (LPOVERLAPPED) &m_SerialRecvOL ); if (!rc && GetLastError() == ERROR_IO_PENDIN G) { waitStatus = WaitForSingleOb ject( m_SerialRecvOL. hEvent, 5000); if (status == WAIT_OBJECT_0){ GetOverlappedRe sult(m_hSerialP ort, &m_SerialRecvOL , pBytesRead, FALSE); rc = TRUE; } }
On windows 98, ReadFile returns with rc = false and pBytesRead = 0 and then the operation is successfully completed later and GetOverlappedRe sult fills in pBytesRead with 6 to indicate 6 bytes read.
On XP, ReadFile returns right away with rc = true and *pBytesRead = 3. I don't get all my data (6 bytes), yet the call to ReadFile indicates that it's done even though it only reads 3 bytes.
Can anyone tell me what I'm missing here?
Thanks, Donna Rigas ioline corporation
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: yamadora1999 |
last post by:
hi :)
http://groups.google.com/groups?q=author:dmost%40magna.com.au&hl=ko&lr=&ie=UTF-8&selm=8pguo8%24bbl%241%40nnrp1.deja.com&rnum=3
GetQueuedCompletionStatus is return new OVERLAPPED yet.
i am tested python2.3 with win32all-163.exe and
python2.4a1 with pywin32-202.win32-py2.4.exe.
|
by: Michelle Kinsey-Clinton |
last post by:
Hello,
I am writing an ASP app which is giving me some very frustrating
errors. They appear intermittently, no real pattern to them, and often
go away if you reload, or back up a few pages and start over again.
The first error is logged as a 400 error and says only, "The parameter
is incorrect." It (mostly, but not always) happens upon submitting a
form, and a reload is generally successful in bringing the page up
just fine. I have...
|
by: AmyAdmin |
last post by:
I am running windows 2000 with IIS 5.0 and I have ASP and .NET apps running
on that server, and I've been getting the error message in my event viewer:
DCom got error "Overlapped I/O operation is in progress" and was unable to
logon .\IWAM_servername in order to run the server.
Followed by another error:
The server stop serving requests for application __________ because of the
number of out of process component crashes exceeded a...
|
by: Lewap |
last post by:
Hi!
I have a problem:
Function CreateNamedPipe (a piece of source below) called in a NT service I
get an error 997 - Overlapped I/O operation is in progress.
When I run the same code as oridinal application (not NT service) everything
works properly.
Service is develop in Managed/Unmanaged C++ (.NET Environment). And is
|
by: CeZaR |
last post by:
Hi,
What does the "overlapped" word means in windows programming?
I've read about overlapped structures, functions?!
What does it mean?
Thanks!
| |
by: dvestal |
last post by:
I'm trying to use Overlapped I/O from C#, and utterly failing. I've
tried to boil down my code to as simple an example as possible, in
hopes that you people can point to where I'm going wrong. I've
included my test program. The behavior I'm seeing is that the callback
routine is never called, despite the fact that the thread is (AFAIK) in
an alertable state. The program just hangs waiting for the
m_doneEvent.
In other scenarios, I'm...
|
by: Eric Renken |
last post by:
I am trying to do an Overlapped ReadFile on a HID device and it just isn't
working for me. The WaitForSingleObject keeps giving me an error "The
system cannot find the file specified."
This code need to work in 64bit and 32bit, so I am using IntPtr for pointers
instead of int.
Here is the structure of OVERLAPPED
public struct OVERLAPPED
|
by: Ingenious |
last post by:
Hi
I am reading data from device in overlapped way.
i am able to read the data correctly with WaitforMultipleObject()
but now i want to use HasOverlappedIoCompleted () to inceraese the speed of processing.
so i have used this function from kernal32 dll as follows
|
by: =?Utf-8?B?TmljayBCdXJraXR0?= |
last post by:
Hi.
I have a C# app that uses named pipes via InteropServices. I have no
problems running on a 32-bit machine, or when targeting x86 architecture, but
it fails on a 64-bit machine when targeting x64 or AnyCPU.
The problem appears to be that ReadFile() sets lpNumberOfBytesRead to 0,
even though the receive buffer contains the data I'm expecting.
Is this a known issue, or am I just doing something dumb?
I can provide a small test app via...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |