Sponsored Content
Top Forums Programming How to convert the "select" function into a "poll" function Post 3724 by Neo on Tuesday 10th of July 2001 10:49:44 AM
Old 07-10-2001
Select is asynchronous, whereas you listen on a socket and when inbound information comes in,the process that is in select mode accepts the data.

Polling would require the process to actively initiate the action to go 'get the data'.

This is a very different method and is not simple matter of converting select (the system call) to another function. You must restructure the algorithm.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

"select" function sequence

Hi folks, As we all know, the "select" function give a number to each element as the number of elements in the select. for example: I have a program which ask a user to select a language: =============================================================================== Please select the... (1 Reply)
Discussion started by: nir_s
1 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. HP-UX

ERROR: more than one instance of overloaded function "vprintf" has "C" linkage

Hi people! I've got this own library: -------------------------------------------- Personal.h -------------------------------------------- #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include <stdarg.h> #include <string.h> ... (0 Replies)
Discussion started by: donatoll
0 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

6. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
IO::Select(3pm) 					 Perl Programmers Reference Guide					   IO::Select(3pm)

NAME
IO::Select - OO interface to the select system call SYNOPSIS
use IO::Select; $s = IO::Select->new(); $s->add(*STDIN); $s->add($some_handle); @ready = $s->can_read($timeout); @ready = IO::Select->new(@handles)->can_read(0); DESCRIPTION
The "IO::Select" package implements an object approach to the system "select" function call. It allows the user to see what IO handles, see IO::Handle, are ready for reading, writing or have an exception pending. CONSTRUCTOR
new ( [ HANDLES ] ) The constructor creates a new object and optionally initialises it with a set of handles. METHODS
add ( HANDLES ) Add the list of handles to the "IO::Select" object. It is these values that will be returned when an event occurs. "IO::Select" keeps these values in a cache which is indexed by the "fileno" of the handle, so if more than one handle with the same "fileno" is specified then only the last one is cached. Each handle can be an "IO::Handle" object, an integer or an array reference where the first element is an "IO::Handle" or an integer. remove ( HANDLES ) Remove all the given handles from the object. This method also works by the "fileno" of the handles. So the exact handles that were added need not be passed, just handles that have an equivalent "fileno" exists ( HANDLE ) Returns a true value (actually the handle itself) if it is present. Returns undef otherwise. handles Return an array of all registered handles. can_read ( [ TIMEOUT ] ) Return an array of handles that are ready for reading. "TIMEOUT" is the maximum amount of time to wait before returning an empty list, in seconds, possibly fractional. If "TIMEOUT" is not given and any handles are registered then the call will block. can_write ( [ TIMEOUT ] ) Same as "can_read" except check for handles that can be written to. has_exception ( [ TIMEOUT ] ) Same as "can_read" except check for handles that have an exception condition, for example pending out-of-band data. count () Returns the number of handles that the object will check for when one of the "can_" methods is called or the object is passed to the "select" static method. bits() Return the bit string suitable as argument to the core select() call. select ( READ, WRITE, EXCEPTION [, TIMEOUT ] ) "select" is a static method, that is you call it with the package name like "new". "READ", "WRITE" and "EXCEPTION" are either "undef" or "IO::Select" objects. "TIMEOUT" is optional and has the same effect as for the core select call. The result will be an array of 3 elements, each a reference to an array which will hold the handles that are ready for reading, writing and have exceptions respectively. Upon error an empty list is returned. EXAMPLE
Here is a short example which shows how "IO::Select" could be used to write a server which communicates with several sockets while also listening for more connections on a listen socket use IO::Select; use IO::Socket; $lsn = IO::Socket::INET->new(Listen => 1, LocalPort => 8080); $sel = IO::Select->new( $lsn ); while(@ready = $sel->can_read) { foreach $fh (@ready) { if($fh == $lsn) { # Create a new socket $new = $lsn->accept; $sel->add($new); } else { # Process socket # Maybe we have finished with the socket $sel->remove($fh); $fh->close; } } } AUTHOR
Graham Barr. Currently maintained by the Perl Porters. Please report all bugs to <perlbug@perl.org>. COPYRIGHT
Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 IO::Select(3pm)
All times are GMT -4. The time now is 08:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy