473,473 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using select(2)

Dear,

using the following:

*my($scount,*$stime)=
*CORE::select(*$read_bits,
****************$write_bits,
****************$err_bits,*1);

In my program, $scount is allways equal to -1,
and $read_bits, $write_bits, $err_bits, to 0.

Does anybody know in wich case it can happen?

thank's in advance
Jul 19 '05 #1
3 4315
memyself_ wrote:
my($scount, $stime)=
CORE::select( $read_bits,
$write_bits,
$err_bits, 1);

In my program, $scount is allways equal to -1,
and $read_bits, $write_bits, $err_bits, to 0.


You did not show us where you were setting $read_bits and such
to be nonzero. You have to set them before each time select()
is called.

$rb = one bit for each file handle you will be reading from
$wb = one bit for each file handle you will be writing to
$eb = $rb | $wb;
$ms = 1.0; # seconds for the timeout
($scount,$stime) = select( $read_bits=$rb, $write_bits=$wb,
$error_bits=$eb, $ms);
warn "Invalid arguments presented to select()" if $scount < 0;
if ($scount == 0) {
print "No file handles are ready for I/O\n";
} else {
print "Can do I/O: r=$read_bits w=$write_bits e=$error_bits\n";
}
print "$stime seconds left before timeout\n" if $stime;

Use 'perldoc -f select' for more info.
Use comp.lang.perl.misc (and not comp.lang.perl) next time.
-Joe
Jul 19 '05 #2
In article <ct**********@news.tiscali.fr>, memyself_ <fo*@bar.man>
wrote:
Dear,

using the following:

*my($scount,*$stime)=
*CORE::select(*$read_bits,
****************$write_bits,
****************$err_bits,*1);

In my program, $scount is allways equal to -1,
and $read_bits, $write_bits, $err_bits, to 0.


Sorry, but I am not familiar with the CORE module, and it is not
mentioned in my Perl book nor found on CPAN. Assuming it is just the
Perl built-in select function that calls the normal Unix select system
call, then you need to set the appropriate bits of $read_bits,
$write_bits, and $err_bits in order for this call to do anything. If
these are all zero, select will return after waiting for the specified
amount of time (1 second in your example) and will never set any bits
in the argument variables.

See 'perldoc -f select' to see how to set and inspect the appropriate
bits to check a particular file handle.

FYI: this newsgroup is defunct; use comp.lang.perl.misc in the future.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 19 '05 #3
Jim Gibson wrote:
In article <ct**********@news.tiscali.fr>, memyself_ <fo*@bar.man>
wrote:
Dear,

using the following:

my($scount,*$stime)=
CORE::select(*$read_bits,
$write_bits,
$err_bits,*1);

In my program, $scount is allways equal to -1,
and $read_bits, $write_bits, $err_bits, to 0.


Sorry, but I am not familiar with the CORE module, and it is not
mentioned in my Perl book nor found on CPAN. Assuming it is just the
Perl built-in select function that calls the normal Unix select system
call, then you need to set the appropriate bits of $read_bits,
$write_bits, and $err_bits in order for this call to do anything. If
these are all zero, select will return after waiting for the specified
amount of time (1 second in your example) and will never set any bits
in the argument variables.


The CORE module is for the perl built-in functions,
to distinguish thelmseve from user functions.
I write it like that to have a high level select subroutine slighty
different from the IO::Select module.

I found the reason by myself today. select return -1 because none of the
bits string are set. I know where to find the bug now.

Thank's for your answers
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
4
by: Pat Turner | last post by:
Hi, I have some XML like this: <family> <person name="bob"> <father ref="../../person" /> </person> <person name="charlie"> <child ref="../../person" />
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
3
by: bloc | last post by:
I am programming an interactive CV using xml, xslt and java script. The page consists of a header which contains links to various 'sections' on the xml cv, a left and right menu, and a central...
8
by: rbg | last post by:
I did use query plans to find out more. ( Please see the thread BELOW) I have a question on this, if someone can help me with that it will be great. In my SQL query that selects data from table,...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
0
debasisdas
by: debasisdas | last post by:
Using Subqueries ================== The sub query is often referred to as a nested SELECT, Sub - SELECT, or inner SELECT statement. The sub query executes once before the main query. The...
1
debasisdas
by: debasisdas | last post by:
Using Co-related sub query ======================== While a subquery is evaluated only once for each table, a correlated subquery is evaluated once for each row. Sub query can take value from...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.