Home Forums Support Transfer ArrayList client

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #857
    Anonymous
    Inactive

    Hello, is it possible to transfer to the client ArrayList?

    send to the client:
    NetworkComms.SendObject("Message", serverIP, serverPort, list_servers);

    client:
    NetworkComms.AppendGlobalIncomingPacketHandler<ArrayList>("Message", PrintIncomingMessage);

    error log:
    Error Log

    #865
    Anonymous
    Inactive

    Heya KyKyIIIKuH,

    Welcome to our forums and thank-you for your interest in our network library.

    ArrayList can not be supported as it is not a strongly typed object. The deserialiser must know exactly what the incoming type is otherwise it throws the error you are seeing. For the same reasons you could not send/receive a List<object>.

    My recommendation would be to:

    1. Use a strongly typed object.

    or

    2. Create a wrapper for your Arraylist and write a manual serialisation / serialisation step for the Arraylist part. We do a similar thing in this tutorial but using an image object instead.

    If you have any further questions please feel free to post back.
    Regards,
    Marc

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