Are you sending direct or guaranteed messages? If you are publishing guaranteed messages, you should wait for the last message acknowledgement before destroying the session. If you are publishing direct messages, you should call solClient_session_disconnect() when you are finished. This method guarantees all buffered data is flushed before closing the tcp transport. After ‘disconnect’ you can destroy the session as usual.