[fpc-pascal] Re: Odyssey: SSockets and Threads.
Ludo Brands
ludo.brands at free.fr
Fri Apr 26 19:25:52 CEST 2013
On 04/26/2013 07:06 PM, silvioprog wrote:
> Ludo, a small question....
>
> So, In loop of my thread, to the process doesn't stay blocked in recv, I
> need to use select in client too?
>
If your socket is in blocking mode and you don't want your thread to
block, yes. Server or client, there is no difference.
The same for send. When you have a small block to send that fits in the
socket buffer and the socket buffer is empty, send will return
immediately. But if you have more data to send, your second send will
block until the first send is completed.
The same select can be used to return when the recv buffer is not empty
or the send buffer empty or when an exception occurs. See
http://linux.die.net/man/2/select
Ludo
More information about the fpc-pascal
mailing list