Home › Forums › Support › input .lzma is too short › Reply To: input .lzma is too short
May 29, 2014 at 09:46
#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