Tagged: lzma, Synchronous Send and Receive
- This topic has 5 replies, 2 voices, and was last updated 10 years, 6 months ago by Anonymous.
-
AuthorPosts
-
May 29, 2014 at 01:07 #2665AnonymousInactive
Hi, I’m using your Synchronous Send and Receive code in the tutorial section. The problem is that the client send the request fine but the server never get it. I found this error file in the server:
Base Exception Type: System.Exception: input .lzma is too short
en LZMA.SevenZipHelper.DecompressStreamToStream(Stream inStream, Stream outStream) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\SevenZipLZMACompressor\SevenZipHelper.cs:línea 285
en SevenZipLZMACompressor.LZMACompressor.ReverseProcessDataStream(Stream inStream, Stream outStream, Dictionary`2 options, Int64& writtenBytes) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\SevenZipLZMACompressor\LZMACompressor.cs:línea 75
en DPSBase.DataSerializer.DeserialiseGeneralObject[T](MemoryStream receivedObjectStream, List1 dataProcessors, Dictionary
2 options) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\DPSBase\DataSerializer.cs:línea 256
en DPSBase.DataSerializer.DeserialiseDataObject[T](MemoryStream receivedObjectStream, List1 dataProcessors, Dictionary
2 options) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\DPSBase\DataSerializer.cs:línea 237
en NetworkCommsDotNet.PacketTypeHandlerDelegateWrapper`1.DeSerialize(MemoryStream incomingBytes, SendReceiveOptions options) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PacketUnwrappers.cs:línea 75
en NetworkCommsDotNet.NetworkComms.TriggerGlobalPacketHandlers(PacketHeader packetHeader, Connection connection, MemoryStream incomingDataStream, SendReceiveOptions options, Boolean ignoreUnknownPacketTypeOverride) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\NetworkComms.cs:línea 1243Stack Trace: en LZMA.SevenZipHelper.DecompressStreamToStream(Stream inStream, Stream outStream) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\SevenZipLZMACompressor\SevenZipHelper.cs:línea 285
en SevenZipLZMACompressor.LZMACompressor.ReverseProcessDataStream(Stream inStream, Stream outStream, Dictionary`2 options, Int64& writtenBytes) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\SevenZipLZMACompressor\LZMACompressor.cs:línea 75
en DPSBase.DataSerializer.DeserialiseGeneralObject[T](MemoryStream receivedObjectStream, List1 dataProcessors, Dictionary
2 options) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\DPSBase\DataSerializer.cs:línea 256
en DPSBase.DataSerializer.DeserialiseDataObject[T](MemoryStream receivedObjectStream, List1 dataProcessors, Dictionary
2 options) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\DPSBase\DataSerializer.cs:línea 237
en NetworkCommsDotNet.PacketTypeHandlerDelegateWrapper`1.DeSerialize(MemoryStream incomingBytes, SendReceiveOptions options) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PacketUnwrappers.cs:línea 75
en NetworkCommsDotNet.NetworkComms.TriggerGlobalPacketHandlers(PacketHeader packetHeader, Connection connection, MemoryStream incomingDataStream, SendReceiveOptions options, Boolean ignoreUnknownPacketTypeOverride) en c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\NetworkComms.cs:línea 1243I hope your can help me. Thanks in advance.
P.D. Sorry for my english.
May 29, 2014 at 01:38 #2666AnonymousInactiveI already fix it. The example is wrong in this line:
CustomObject myCustomObject = serverConnection.SendReceiveObject<CustomObject> ("RequestCustomObject", "CustomObjectReply", 1000);
Is missing the 4th parameter:
CustomObject myCustomObject = serverConnection.SendReceiveObject<CustomObject> ("RequestCustomObject", "CustomObjectReply", 1000, DATA_YOU_WANT_SEND);
- This reply was modified 10 years, 6 months ago by .
May 29, 2014 at 09:32 #2668AnonymousInactiveThank-you for the correction. I will update the example.
Regards,
MarcMay 29, 2014 at 09:46 #2672AnonymousInactiveI have just tested the original example, without any problems:
[ProtoBuf.ProtoContract] class CustomObject { public CustomObject() { } } public static void RunExample() { //Append a packet handler that will get executed when the server receives a "RequestCustomObject" packetType. //Note: The expected incoming object type here is irrelevant because the client is not providing an object //If the client does not provide an object when sending the incoming object is set to GetDefault(Type). NetworkComms.AppendGlobalIncomingPacketHandler<int>("RequestCustomObject", (packetHeader, connection, input) => { //For this short example we just reply with a new CustomObject CustomObject myCustomObject = new CustomObject(); //When this is received by the client it will complete the synchronous request connection.SendObject("CustomObjectReply", myCustomObject); }); //Start listening for incoming TCP connections Connection.StartListening(ConnectionType.TCP, new IPEndPoint(IPAddress.Any, 10000)); try { //Create a connectionInfo object that specifies the target server ConnectionInfo connectionInfo = new ConnectionInfo("127.0.0.1", 10000); //Get a connection with the specified connectionInfo TCPConnection serverConnection = TCPConnection.GetConnection(connectionInfo); //Send a packet of type RequestCustomObject and wait synchronously until CustomObject myCustomObject = serverConnection.SendReceiveObject<CustomObject>("RequestCustomObject", "CustomObjectReply", 10000); //Perform further operations on the received object here } catch (ExpectedReturnTimeoutException) { //We can decide what to do here if the synchronous send and receive timed out after the specified 1000ms } Console.WriteLine("Client done!"); Console.ReadKey(); }
i.e. the 4th parameter on the send is not required.
I am not sure exactly what about your configuration is causing problem or why adding a fourth parameter to the send makes any difference.
What platforms are you testing on?
Marc
May 29, 2014 at 17:57 #2674AnonymousInactiveI’m using networkcomms 2 on windows 7 with .net 4.5
Maybe it as a bug on version 2?
May 29, 2014 at 18:10 #2675AnonymousInactivequite possibly. NetworkComms.Net has moved a LONG way since version 2.
Regards,
Marc -
AuthorPosts
- You must be logged in to reply to this topic.