473,385 Members | 1,343 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,385 software developers and data experts.

End of Stream encountered before parsing was completed

Hi all

I've serializing an object to a Network stream but when trying to
deserialize
it comes back with
"End of Stream encountered before parsing was completed."

Using Binary formatter to send across.

Any idea how to solve this.
Thanks in advance.
Guru
Jun 18 '06 #1
2 15508
Guru,

It's very possible that the stream is closed for some reason (network
problems) before deserialization completes.

If you want to be sure, you should send some sort of length prefix
before the serialized object stream. Then, read the bytes into a local
buffer, then deserialize from that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Guru" <Gu**@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
Hi all

I've serializing an object to a Network stream but when trying to
deserialize
it comes back with
"End of Stream encountered before parsing was completed."

Using Binary formatter to send across.

Any idea how to solve this.
Thanks in advance.
Guru

Jun 18 '06 #2
Hi Nicholas

First Thanks for your reply...

Can you elloborate on code level. B'coz I am serializing the object(Object
o). So how to find the length and send it back?

Please give me some pointer.
My code is like :-

Serilizing:
-----------
IFormatter m_formatter;
NetworkStream n_stream;
.....
...
m_formatter.Serialize(n_stream,o);
....
....
Deserializing on TCP client:
------------------------------
....
....
Object o = m_formatter.Deserialize(n_stream);
.........

So any idea??
Thanks in advance..
Guru

"Nicholas Paldino [.NET/C# MVP]" wrote:
Guru,

It's very possible that the stream is closed for some reason (network
problems) before deserialization completes.

If you want to be sure, you should send some sort of length prefix
before the serialized object stream. Then, read the bytes into a local
buffer, then deserialize from that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Guru" <Gu**@discussions.microsoft.com> wrote in message
news:C6**********************************@microsof t.com...
Hi all

I've serializing an object to a Network stream but when trying to
deserialize
it comes back with
"End of Stream encountered before parsing was completed."

Using Binary formatter to send across.

Any idea how to solve this.
Thanks in advance.
Guru


Jun 19 '06 #3

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

Similar topics

1
by: Durairaj Avasi | last post by:
#!/usr/bin/perl -w use Net::LDAP; use Net::LDAP::Util qw(ldap_error_name ldap_error_text); my $ldap = Net::LDAP->new('xy.webdurai.net', port=> 389) or die "$@"; $ldap->debug(15); my @args = (...
0
by: Thomas Engelmeier | last post by:
Hi, I need an expat-alike parser (ABI-wise as much a drop-in replacement as possible) for C/C++ with the following additions: - in order to handle some tags with nesting in completely...
5
by: Rafal 'Raf256' Maj | last post by:
Hi, I need to parse a file. This means reading from it as from std::istream. But - sometimes I also need to put-back some text I read before. What type of string can I use for that? Something...
4
by: seema_coma | last post by:
I am working under a Linux environment, and I want to "read stream up to next delimiter". It looks like linux doesnt't have a function such as bgets() All i need is, reading characters from...
1
by: Solel Software | last post by:
Hello, I am attempting to serialize an object for storage in a DB field and them deserialize it later on. I have managed to Serialize it using private string SerializeObject(object...
5
by: Solel Software | last post by:
Hello, I am attempting to serialize an object for storage in a DB field and them deserialize it later on. I have managed to Serialize it using private string SerializeObject(object...
1
by: Zorpiedoman | last post by:
The following code explains my problem. It works fine if I use a file stream, but not if I use a memory stream. What's the problem here? It must be something simple I am missing... Dim H As...
9
by: ThePants | last post by:
Hi, given the following code, I've been successful in grabbing pages for parsing, but for a certain page template (containing a particular piece of code) the stream always ends right after that...
0
by: Janusz Nykiel | last post by:
I've stumbled upon unexpected behavior of the .NET 2.0 System.Xml.XmlWriter class when using it to write data to a binary stream (System.IO.Stream). If the amount of data is less than a certain...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.