Home Forums Support Close conecction after all packets are send Reply To: Close conecction after all packets are send

#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