Thanks Jason.

I'm a Linux guy trying to work on Windows, so this might just be my
lack of knowledge.

I get this error when flushing the stream (via the destructor that is
called when exiting scope):

msvcr100.dll!_crt_debugger_hook(int _Reserved)  Line 65 C
        msvcr100.dll!_call_reportfault(int nDbgHookCode, unsigned long
dwExceptionCode, unsigned long dwExceptionFlags)  Line 167 + 0x6 bytes
C++
        msvcr100.dll!_invoke_watson(const wchar_t * pszExpression, const
wchar_t * pszFunction, const wchar_t * pszFile, unsigned int nLine,
unsigned int pReserved)  Line 155 + 0xf bytes   C++
        msvcr100.dll!_invalid_parameter(const wchar_t * pszExpression, const
wchar_t * pszFunction, const wchar_t * pszFile, unsigned int nLine,
unsigned int pReserved)  Line 110 + 0x14 bytes  C++
        msvcr100.dll!_invalid_parameter_noinfo()  Line 121 + 0xc bytes  C++
        msvcr100.dll!_write(int fh, const void * buf, unsigned int cnt)
Line 67 + 0x24 bytes    C
        WinGateway.exe!
google:rotobuf::io::FileOutputStream::CopyingFileOutputStream::Write()
Line 244 + 0xf bytes    C++
        WinGateway.exe!
google:rotobuf::io::CopyingOutputStreamAdaptor::WriteBuffer()  Line
367 + 0x10 bytes        C++
        WinGateway.exe!
google:rotobuf::io::FileOutputStream::~FileOutputStream()  Line 180     C+
+
        WinGateway.exe!igrpc::Connection::writeMessage(int fieldNumber,
google:rotobuf::MessageLite & message)  Line 531        C++

You can see that the write function inside
FileOutputStream::CopyingFileOutputStream::Write fails.

I've read the following which made me originally question whether the
protobuf api would work correctly on windows:
"..file operations such as read(), write(), and close() cannot be
assumed to work correctly when applied to socket descriptors.. Sockets
must be closed by using the closesocket() 
http://www.sockets.com/winsock.htm#CloseSocket,
http://www.sockets.com/winsock.htm

But then you mentioned that the unit test indicate it should work. I
looked at the unit test and they seem to be using file descriptors for
files and not sockets. Could it be that with sockets it fails and with
files it works fine?

Thanks again.

Patrick

On Apr 20, 6:17 pm, Jason Hsueh <jas...@google.com> wrote:
> I suppose this should read POSIX file descriptors, which Windows supports. I
> have never used protobuf on Windows personally, but the project is tested on
> Windows during the release process, and zero_copy_stream_unittest.cc has
> test cases for using file descriptors.
>
>
>
>
>
>
>
> On Wed, Apr 20, 2011 at 5:56 PM, Patrick <schultz.patr...@gmail.com> wrote:
> > I'm in the process of porting my custom protobuf RPC library to
> > windows and have run into a snag.
>
> > I'm using the CodedInputStream class to read messages. The
> > documentation for zero_copy_input_stream.h implies that this is only
> > compatible with linux:
>
> > "These implementations include Unix file descriptors and C++
> > iostreams."
>
> > Am I missing something? It was my assumption that the entire protobuf
> > library was platform independent (at least the external API's). Maybe
> > someone could point me to an example of instantiating a
> > CodedInputStream under Windows/VS enviro?
>
> > Regards,
> > Patrick
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To post to this group, send email to protobuf@googlegroups.com.
> > To unsubscribe from this group, send email to
> > protobuf+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/protobuf?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to