Home Forums Support Close conecction after all packets are send

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

    Hi, I’m using the 2 version.

    My problem is after use the SendObject method I close the connection but the object sometimes do not arrives to the server, but if I sleep the app before close the connection, the object arrives fine.

    Who can I solve this?

    Thanks for advance.

    #2687
    Anonymous
    Inactive

    When the default send returns there is no guarantee that the data has been sent/received. If you close the connection immediately afterwards, not receiving data, would be an expected consequence.

    To get around this issue you should enable receive confirmation for the connection. This ensures that when the a send returns the data has been successfully received.

    Enabling receive confirmation packets is done in a suitable SendReceiveOptions:

    SendReceiveOptions options = (SendReceiveOptions)NetworkComms.DefaultSendReceiveOptions.Clone();
    options.ReceiveConfirmationRequired = true;
    Connection conn = TCPConnection.GetConnection(targetServerConnectionInfo, options);

    Kind regards,
    Marc

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