For connect, I wrote a unit that implements a connect timeout, see:
http://sourceforge.net/p/pascalscada/code/HEAD/tree/trunk/src/scada/sockets_w32_w64.pas#l70
or
http://sourceforge.net/p/pascalscada/code/HEAD/tree/trunk/src/scada/sockets_unix.pas#l48
If you want work in blocking mode after con
On Wednesday 17 April 2013 10:22:58 you wrote:
> I thought MSG_DONTWAIT is actually the flag to switch to nonblocking mode,
> isn't it?
May be.
> As a matter of fact, the fprecv() above would get a result of -1
> and a sockterror of "Try Again", which is exactly the behavior of
> nonblocking read.
I thought MSG_DONTWAIT is actually the flag to switch to nonblocking mode,
isn't it? As a matter of fact, the fprecv() above would get a result of -1
and a sockterror of "Try Again", which is exactly the behavior of
nonblocking read.
2013/4/17 Rainer Stratmann
> On Wednesday 17 April 2013 09:
On Wednesday 17 April 2013 09:17:09 you wrote:
> Will this be a CPU hog:
>
> t := Now;
> while fprecv(s, @buf, buf_len, MSG_DONTWAIT) < 0 do begin
> if Now - t > 0.1 * timeout then Break; // approx. seconds
> end;
>
> Thanks
I did not read the whole thread, but that you favorite blocki
Will this be a CPU hog:
t := Now;
while fprecv(s, @buf, buf_len, MSG_DONTWAIT) < 0 do begin
if Now - t > 0.1 * timeout then Break; // approx. seconds
end;
Thanks
2013/4/16 Luca Olivetti
> Al 16/04/13 12:20, En/na Michael Schnell ha escrit:
> > On 04/16/2013 11:26 AM, Xiangrong Fang
Al 16/04/13 12:20, En/na Michael Schnell ha escrit:
> On 04/16/2013 11:26 AM, Xiangrong Fang wrote:
>> How can I set the connection and read/write timeout when using socket
>> in free pascal?
> I seem to remember that synapse can do this.
Only in svn and it does it this way
if FConnectionTimeout
On 16/04/13 11:26, Xiangrong Fang wrote:
Hi there,
How can I set the connection and read/write timeout when using socket
in free pascal? I like the way it works now (blocking, NOT async),
but the timeout is a bit too long.
BTW, I hope the way to control timeout is withing the program and
p
Michael Schnell wrote:
On 04/16/2013 11:26 AM, Xiangrong Fang wrote:
How can I set the connection and read/write timeout when using socket
in free pascal?
I seem to remember that synapse can do this.
Otherwise for non-standard protocols use fpconnect(), fpselect() etc.
--
Mark Morgan Lloyd
m
On 04/16/2013 11:26 AM, Xiangrong Fang wrote:
How can I set the connection and read/write timeout when using socket
in free pascal?
I seem to remember that synapse can do this.
-Michael
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http: