You posted the same question to pilot.programmer.gcc. I posted my reply there.
(Markus knows this; I'm just posting this here for the benefit of others.)

-- Keith Rollin
-- Palm OS Emulator engineer






Markus Arzl <[EMAIL PROTECTED]> on 08/09/99 04:10:06 PM

Please respond to [EMAIL PROTECTED]

Sent by:  Markus Arzl <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:    (Keith Rollin/HQ/3Com)
Subject:  Help! Time-out doesn't apply when reading from a socket!




Hey Folks,

Why doesn't work time-outs for read() on sockets ?
In my code it blocks until some data arrives or the connection breaks.
It doesn't matter which timeout-value I set, tried things like: 0 ticks,

1 tick, 10 ticks, 1 second, 20 seconds, ... . All of em block forever.

what am I doing wrong, where's the trick?

here are some code fragments:
--------------------8<-----------------
Setup:
  err = SysLibFind("Net.lib", &AppNetRefnum); ...
  err = NetLibOpen(AppNetRefnum, &ifErrs);  ...
  AppNetTimeout = SysTicksPerSecond() * 10;

Open connection:
  SocketRef = NetUTCPOpen( par_ip, NULL, par_port);

Read ( first line in the event loop):
      l = read( SocketRef, ReadBuffer, READ_BUFFER_SIZE);

      //l = NetLibReceive( AppNetRefnum, SocketRef, ReadBuffer,
READ_BUFFER_SIZE, 0, 0, 0, 0, &errno); // doesn't work either!
--------------------8<-------------------

I'm using Copilot 2.1d29  -  is this the problem?
1.0beta9 which comes with the GNU SDK doesn't seems seem to support
networking - is this right?

I'd need to react to user inputs while waiting for data to arrive,
that's why the time-out is that important.

Any suggestions?

 Markus









Reply via email to