|
From: | Michael Cronenworth |
Subject: | Re: gnutls_record_recv() hangs |
Date: | Mon, 15 Aug 2011 16:54:49 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 |
Dinh Le wrote:
But this hack does not work since the previously received message may be less than 1024 bytes long but there are still more data available for receiving. Worse yet, gnutls_record_recv() would hang indefinitely if there's no data available to be received.
You will need to use non-blocking I/O if you want to do multiple reads without hanging.
You have two options: 1. Add large static buffers and do one read.2. Use non-blocking I/O and do multiple reads in blocks (the size can be up to you) and dynamically allocate memory to receive an unknown size data packet.
[Prev in Thread] | Current Thread | [Next in Thread] |