bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in socket.cpp for Win32, version 1.5.1


From: Spell, David
Subject: Bug in socket.cpp for Win32, version 1.5.1
Date: Wed, 3 Oct 2001 18:15:18 -0700

Hello,

When I try to compile and run apesock.dsw, I get a console app that GPFs in
tcp.cpp at the line "tcp >>  i."  I have extended the tcp.isPending timeout
value to TIMEOUT_INF, so I can press a key before the server closes the
connection, but otherwise, the server app is unchanged.  I connect to it
using "telnet 127.0.0.1 4096," and then press a key on the telnet-side.

Tracing this down, I found that what happens is that the "use_facet"
function in the STL file, XLOCALE, throws a bad_cast exception because there
is apparently no default locale for tcp.  Below is the actual "_THROW" that
causes a problem.  

        else if (!_Cfacet || !_L._Iscloc())
                    _THROW(bad_cast, "missing locale facet");

I didn't think I had to set up the locale for tcp (I don't for cout), but I
went ahead and added the following to "TCPStream::TCPStream(bool throwflag)"
in socket.cpp:

        streambuf::imbue(locale("C"));  // Estab locale.
        iostream::imbue(locale("C"));   // Estab locale.

This prevented the exception, but now after I execute "tcp >> i," none of
the remaining tcp-output commands work; I get no output at the telnet-client
side, when 'tcp << "user entered " << i << endl' is executed.

Please tell me if I am doing something wrong, but I'm not seeing it.

Thanks in advance!

Regards,

Dave.

FYI:

Platform:       Win2K SR-2
IDE:            Visual C++ 6



Dave Spell
Staff Software Engineer
Illumina, Inc.
9390 Towne Centre Drive
San Diego, CA 92121
(858) 587-4290 x516

We're moving!
Effective October 1, Illumina's new address will be:

9885 Towne Centre Drive
San Diego, CA  92121-1975
T:  (858) 202-4500 Main


 <<David Spell (E-mail).vcf>> 

Attachment: David Spell (E-mail).vcf
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]