Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ace-users] Windows error 10038 when writing to a serial port file handle

28 views
Skip to first unread message

Tom Blocker

unread,
Feb 17, 2010, 9:04:01 PM2/17/10
to ace-...@list.isis.vanderbilt.edu
ACE VERSION: 5.7.6

HOST MACHINE and OPERATING SYSTEM:
A very clean Windows XP

TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
Windows 2K and later
Some day Linux

THE $ACE_ROOT/ace/config.h FILE :
#include "ace/config-win32.h"

THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
use a link to a platform-specific file, simply state which one
(unless this isn't used in this case, e.g., with Microsoft Visual
C++)]:
NA

BUILD METHOD USED:
Visual Studio version 2008 building project ace\ACE_vc9.vcproj


DOES THE PROBLEM AFFECT:
Execution, i.e. encounters error 10038

SYNOPSIS:
Since updating ACE, performing asynchronous write to file handle fails with windows error 10038

DESCRIPTION:
I'm creating a Window's service to communication with electronic devices over Direct Serial (Including TAPI Modem) using the ACE Proactor.

I have code that has been working for months using ACE version 5.5.6.

Today I downloaded and built the latest version of ACE and am encountering an error message when calling ACE_Asynch_Write_File::write.

I think I have traced the problem to function ACE_WIN32_Asynch_Write_Stream::shared_write
with your addition of the block of code:
#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)).
initiate_result = ::WSASend
on line 1010 file Win32_Asynch_io.cpp causes error 10038. Commenting out the ifdef section
#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0))
corrects my problem.

I suspect that I must be breaking some new rule somewhere or doing something that you don't expect, but I am a little confused why the file handle is being cast to a SOCKET. And noting that 10028 is an error about Socket operation on nonsocket... (http://msdn.microsoft.com/en-us/library/ms740668%28VS.85%29.aspx) ???

A little bit about what I am doing follows:

I open the connection to the comport like this:

this->handle_ = ACE_OS::open (fetch_qualified_port_name().c_str(), //eg "\\.\COM1"
_O_RDWR | FILE_FLAG_OVERLAPPED);

this gives me a valid file handle.

I then init the tty params in unremarkable fashion using ACE_TTY_IO::Serial_Params and ACE_TTY_IO. This completes without reporting an error

I open the streams
m_async_read_stream.open(*this, this->handle_)
m_async_write_stream.open(*this, this->handle_)
where streams are ACE_Asynch_Read_File and ACE_Asynch_Write_File


I prep a message block with a CRLF setting the write ptr.

Then I attemt\pt to write to the port
this->m_async_write_stream.write(mb, nbytes)

Here I hit error 10038.

Like I said this worked in version 5.5.6 for several months, but fails now that I updated ACE.

So what am I doing wrong?

Thanks for your help.

Tom


REPEAT BY:
[What you did to get the error; include test program or session
transcript if at all possible. ]
See above
SAMPLE FIX/WORKAROUND:
[If available ]
Comment out block of code defined by WINSOCK2

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Blocker
Senior Software Engineer
PC Software
Schweitzer Engineering Laboratories, Inc.
Phone: 509-332-1890 x1780
tom_b...@selinc.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



0 new messages