473,287 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Boost serialization : Stream error exception

{ not sure you're aware of that but there are the newsgroups for all
major operating systems. you might want to try asking in the forum
'comp.os.linux.development.apps', since memory-mapped files are not
a language-supported structure, they are platform-specific. -mod }

I'm trying to use boost serialization to serialize/deserialize data to
and from a mmap'd file. I have my own ostream/istream classes that
essentially read/write bytes from a mmap'd file. The process works fine
except on some rare occasions (With different objects/number of
objects), in which case boost throws a "stream error" exception. Any
ideas what could trigger this? A search of the Boost archives indicated
other people had the same problem, where the solution was "use binary
mode when you open the file"... but I'm not using a file on disk, I'm
using a mmap'd file.

The OS i'm using is Linux.
Thanks for any suggestions...
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Aug 24 '06 #1
2 6583

sm*******@excite.com wrote:
[...]
I'm trying to use boost serialization to serialize/deserialize data to
and from a mmap'd file. I have my own ostream/istream classes that
essentially read/write bytes from a mmap'd file. The process works fine
except on some rare occasions (With different objects/number of
objects), in which case boost throws a "stream error" exception. Any
ideas what could trigger this? A search of the Boost archives indicated
other people had the same problem, where the solution was "use binary
mode when you open the file"... but I'm not using a file on disk, I'm
using a mmap'd file.
In my opinion you stand better chances of receiving help if you post to
the Boost User mailing list:
http://www.boost.org/more/mailing_lists.htm#users

Cheers,
Nicola Musatti
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Aug 24 '06 #2
sm*******@excite.com wrote:
{ not sure you're aware of that but there are the newsgroups for all
major operating systems. you might want to try asking in the forum
'comp.os.linux.development.apps', since memory-mapped files are not
a language-supported structure, they are platform-specific. -mod }
I'm trying to use boost serialization to serialize/deserialize data to
and from a mmap'd file. I have my own ostream/istream classes that
essentially read/write bytes from a mmap'd file. The process works fine
except on some rare occasions (With different objects/number of
objects), in which case boost throws a "stream error" exception.
On reading, or on writing? And what does "stream error" mean: I
would expect that it refers to an error returned by the
iostream, but it would be best to be sure---it could also refer
to an error in the format of the input stream (unexpected EOF,
etc.).
Any ideas what could trigger this? A search of the Boost
archives indicated other people had the same problem, where
the solution was "use binary mode when you open the file"...
but I'm not using a file on disk, I'm using a mmap'd file.
The image must be binary, i.e. when you read, you must be
guaranteed to see exactly the same bytes as when you wrote.

Writing to a mmap'd file can be tricky. Basically, mmap (at
least under Unix) presents a view of a fixed length file; if a
write would extend the file, you have to take special actions.
If you don't, it's entirely possible that when you reread the
file, you loose a bit at the end. (It's also possible, of
course, that you core dump on writing.)

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Aug 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: eyal.susser | last post by:
Hi, I'm using the Boost serialization library. Iwant to serialize classes into simple buffers on RAM. There doesn't seem to be a suitable archiver. Am I missing it? The ones I saw were for...
4
by: ron | last post by:
Hi, I have class object that i serialize using the System.Xml.Serialization class. Intermittently the object is not getting serialized correctly, using System.Xml.Serialization classes....
1
by: Sacha | last post by:
I'm having trouble serializing some of my classes when using late binding. When I don't use late binding, it works fine. MyClass inherit from an abstract class called AbsMyClass. If I do the...
4
by: Aaron Clamage | last post by:
Hi, Could someone please confirm the following? I think I have found a subtle .NET serialization bug. It occurs when object has a list of items containing another object of the same type and...
3
by: Steve | last post by:
I've been following a couple remoting tutorials on the web, they are all pretty much the same. I've got my different applications built(client, server and remote object (dll)) The client is...
2
by: Maximus | last post by:
Hi Everyone, I was using Inprocess session objects, but incase of aspnet process crashes the session objects were lost as a result I decided to shift to out of porocess session objects. For this...
1
by: Noah Roberts | last post by:
Trying to use boost::function in a C++/CLI program. Here is code: pragma once #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <vector> using namespace System;
0
by: Abhishek Padmanabh | last post by:
I have been trying out boost's serialization library for the past few days. And I have come across a problem serializing a class that has a reference member. The code is posted as below: ...
8
by: =?Utf-8?B?UGlnZ3k=?= | last post by:
Hi to all, I am getting this System.OutOfMemoryException calling the Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(<stream>,<Obj>) method. The type of <streamis...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.