Home Forums Support How to send and receive custom objects?

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

    I would like to send and receive custom objects and delegate the receive to a function on the server side. I have only got typed objects to work e.g <string>. I wont a single function to handle all types of incoming objects.

     

    Server side:

    private void Form_Load(object sender, EventArgs e)

    {

        NetworkComms.AppendGlobalIncomingPacketHandler<object>(“CLIENT_MESSAGE”,IncomingMessage);

        TCPConnection.StartListening(newIPEndPoint(IPAddress.Parse(localIPAddress()), 54321));

    }

    private void IncomingMessage(PacketHeader header, Connection connection, object message)

    {

    do somthing with message…

    string test = (string)message;

    }

    Client side:

    private void Logon()

    {

    connection = TCPConnection.GetConnection(newConnectionInfo(ServerIP.ToString(), ServerPort));

    connection.SendReceiveObject<object>(“CLIENT_MESSAGE”, ServerIP.ToString(), ServerPort, “LOGON”);

    }

     

     

     

    #707
    Anonymous
    Inactive

    Heya DarkLord,

    Thanks for your interest in our library and welcome to the forums. There is an example included the downloadable source bundle which demonstrates how to send custom objects. Please see the file AdvancedSend.cs within the ExamplesConsole project.

    If you still have problems please post back.

    Regards,

    Marc

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