in reply to Re: Re: socket reading...
in thread socket reading...

from perlfunc select (second select entry :) )

      The usual idiom is:
($nfound,$timeleft) = select($rout=$rin, $wout=$win, $eout=$ein, $timeout);
select overwrites $rout (your $read) to indicate what's available. So, except in the simplist case (1 fd, quit when done, like your example), it needs to be reset to the original on each call. You would need to if, for instance, you uncomment your vec(...FILE2) line.

  p

Replies are listed 'Best First'.
Re: Re: Re: Re: socket reading...
by jdv79 (Sexton) on Jul 31, 2001 at 02:18 UTC
    Got it. How do I get what filehandle is ready for reading? I can see $nfound go high or low but if I had more than one sock open at one time it would be important to differentiate. Also, have you ever heard of GLOB(HEX_ADDY)? I cant find much on this reference type. I know that ref will return "glob" when called on such a ref. Does one just deref as if it was an array. I honestly forget how I got that value. I think it was from the select object in IO::SELECT. Just curious.
      AFAIR, you have to test for each bit in the returned vec. eg, vec($fl1bit,fileno FILE1, 1); ... if ($read & $fl1bit) {..., etc. Try IO::Socket (in the core distribution) instead.
      If you find out how you got a glob reference to a hex address let us know. Its not familiar to me.

        p