.NET Framework Bookmark and Share   
 index > .NET Remoting and Runtime Serialization > SerializationException "The input stream is not a valid binary format" and sockets
 

SerializationException "The input stream is not a valid binary format" and sockets

I am using the System.Messaging.MessageQueue to send and receive multicast System.Messaging.Message’s on my LAN �this works fine.

However, I have a requirement to receive the msgs without using a message queue.

As the MessageQueue uses the PGM protocol (113) to send messages I am trying to build a type that listens on protocol 113 using a socket (e.g. new Socket(AddressFamily.InterNetwork, SocketType.Rdm, (ProtocolType)113);). The type is receiving the data but when I try deserialize the object using the code below it fails with a SerializationException "The input stream is not a valid binary format. The starting contents (in bytes) are: 50-4F-53-54-20-32-33-39-2E-32-30-30-2E-32-35-35-2E ..."

Deserialization code:

MemoryStream ms = new MemoryStream(data,offset,length);

BinaryFormatter f = new BinaryFormatter();

object obj = f.Deserialize(ms);

Any ideas are appreciated - thanks

OO_Dev_Guy
The message i recieve is in text with a soap formatter section (see example from msdn below). The message doesn’t contain the binary data I require. Any ideas on how I can access it?

 POST 234.1.1.1:8001 HTTP/1.1
Host: 234.1.1.1:8001
Content-Type: multipart/related; boundary="MSMQ - SOAP boundary, 292";
type=text/xml
Content-Length: 1067
SOAPAction: "MSMQMessage"
Proxy-Accept: NonInteractiveClient

--MSMQ - SOAP boundary, 292
Content-Type: text/xml; charset=UTF-8
Content-Length: 779
<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://schemas.xmlsoap.org/srmp/">
<se:Header>
<path xmlns="http://schemas.xmlsoap.org/rp/" se:mustUnderstand="1">
<action>MSMQ:mqsender label</action>
<to>MSMQ:MULTICAST=234.1.1.1:8001</to>
<id>uuid:4494@32221eda-9376-46df-b6ed-783091123831</id>
</path>
<properties se:mustUnderstand="1">
<expiresAt>20380119T031407</expiresAt>
<sentAt>20070608T023719</sentAt>
</properties>
<Msmq xmlns="msmq.namespace.xml">
<Class>0</Class>
<Priority>3</Priority>
<Correlation>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</Correlation>
<App>0</App>
<BodyType>8</BodyType>
<HashAlgorithm>32772</HashAlgorithm>
<SourceQmGuid>32221eda-9376-46df-b6ed-783091123831</SourceQmGuid>
<TTrq>20070612T023719</TTrq>
</Msmq>
</se:Header>
<se:Body></se:Body>
</se:Envelope>--MSMQ - SOAP boundary, 292
Content-Type: application/octet-stream
Content-Length: 20
Content-Id: body@32221eda-9376-46df-b6ed-783091123831

OO_Dev_Guy

You can use google to search for other answers

Custom Search

More Threads

• Remoting .config file problem in non en-us OS.
• .net remoting in windows service
• Why can't I access my remote object's properties?
• Share singleton object between different remote object under IIS
• Synchronous interprocess call takes too long
• A way to redirect remote object method call to another server
• Remoting and CrossAppDomain
• CallContext
• Changing service assembly info - stops client connects. Should it?
• Exception Handling, remoting