Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

want to convert blocking read socket into nonblocking

0 views
Skip to first unread message

dino...@hotmail.com

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
Hi,
I have a small piece of TCP/IP client side code, which connects to
server and start reading.

....
while(defined($line = <SOCK>))
{
if ($line == "")
{
print $line;
}
else
{
print "It does not come in this line"
}
}

....

How do i change read into a nonblocking call? I just want process to
wait for 5secs on read.
The select($line=<SOCK>,undef,undef,5) does not help me, or I am using
it is wrong way.

Thanks
Dinesh Verma


Sent via Deja.com http://www.deja.com/
Before you buy.

dino...@hotmail.com

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
Hi again,
Just want add more, I want to get rid of using fork(), which I am
currently using. One for read and other for write, to same socket.
Thanks
Dinesh Verma.

In article <811mnj$9kr$1...@nnrp1.deja.com>,


dino...@hotmail.com wrote:
> Hi,
> I have a small piece of TCP/IP client side code, which connects to
> server and start reading.
>
> ....

Kragen Sitaker

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
In article <811mnj$9kr$1...@nnrp1.deja.com>, <dino...@hotmail.com> wrote:
>How do i change read into a nonblocking call? I just want process to
>wait for 5secs on read.
>The select($line=<SOCK>,undef,undef,5) does not help me, or I am using
>it is wrong way.

You are using it the wrong way. perldoc -f select and perldoc perlipc.
--
<kra...@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>

Ala Qumsieh

unread,
Nov 19, 1999, 3:00:00 AM11/19/99
to

dino...@hotmail.com writes:

> How do i change read into a nonblocking call? I just want process to
> wait for 5secs on read.

Checkout perlfaq8:

How do I timeout a slow event?


0 new messages