Home Forums Support input .lzma is too short

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2665
    Anonymous
    Inactive

    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, Dictionary2 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, Dictionary2 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 1243

    Stack 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, Dictionary2 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, Dictionary2 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 1243

    I hope your can help me. Thanks in advance.

    P.D. Sorry for my english.

    #2666
    Anonymous
    Inactive

    I 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 7 years, 7 months ago by .
    #2668
    Anonymous
    Inactive

    Thank-you for the correction. I will update the example.

    Regards,
    Marc

    #2672
    Anonymous
    Inactive

    I 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

    #2674
    Anonymous
    Inactive

    I’m using networkcomms 2 on windows 7 with .net 4.5

    Maybe it as a bug on version 2?

    #2675
    Anonymous
    Inactive

    quite possibly. NetworkComms.Net has moved a LONG way since version 2.

    Regards,
    Marc

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.