[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Think there is a problem in ost::Socket::setCompletion
From: |
Michael Uman |
Subject: |
Think there is a problem in ost::Socket::setCompletion |
Date: |
Wed, 28 Jul 2004 13:48:39 -0700 |
Hello,
I think I just fixed a bug in Socket::setCompletion.
Here is what has happened... I have an application which uses wxWindows
and CommonCpp. It works fine on both Windows and Linux when run
natively. But I decided to try to run the Windows executable using the
WINE emulator. Now the Wine debugger complained about a problem. I built
everything for debug, and used the .pdb's generated. Now when wine hit
the problem , the stack trace indicated it was in the ioctlsocket
function, called from setCompletion. I looked into the source code and
noticed that the call doesn't conform to the Windows Platform SDK
description of the function. According to the docs the prototype of
ioctlsocket is:
int ioctlsocket(
SOCKET s,
long cmd,
u_long* argp
);
This indicates that the 3rd argument is a pointer to an u_long {unsigned
long int}. It appears in the socket.cpp module that the integer 0 or 1
is passed in the argument. The SDK describes the FIONBIO ioctl using the
following language:
FIONBIO
>>The argp parameter is a pointer to an unsigned long value<<. Set argp
to a nonzero value if the nonblocking mode should be enabled, or zero if
the nonblocking mode should be disabled. When a socket is created, it
operates in blocking mode by default (nonblocking mode is disabled).
This is consistent with BSD sockets. argp value Nonblocking mode
0 Disabled
nonzero Enabled
I modified the source and rebuilt the ccgnu2.dll {actually the
ccgnu2d.dll} and retried my tests. Now everything works well. I am still
having another problem concerning commoncpp ost::Socket::error when it
comes to throwing an exception. But this error only occurs when my app
is unable to attach to the server {workable but still not acceptable}.
My patch is attached to this email... basically just pass the ulong
which is set according to the immediate flag {you'll see...}...
I hope this is helpful. Also, thank you for maintaining such a useful
cross-platform function library... ;)
Thank you,
Michael A. Uman
Sr. Software Engineer, System tools
Sigma Designs
socket_patch.diff
Description: Text document
- Think there is a problem in ost::Socket::setCompletion,
Michael Uman <=