it still looks to me that your loop only is for accepting new connections and still only reads a connection ONCE then exits...
I generally don't have a need for a fork() and use select() in the main loop. You can use select() in your child too. It'll sleep until something is available to read.
Suppose i am writing a C program which is going to use Socket calls. I want to use a Unix port for my Socket.
How can i determine a port which is not already in use? (1 Reply)
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
Hi ,
I'm facing the following problem in socket programming.
My structure is
struct {
int i;
char *str;
}samp;
I'm creating the pointer to this structure and assigning the value to the structure members and send via the socket to the another process.
The receiver process when... (7 Replies)
Hello!:)
I'm trying to do some socket programming based on the following situation:
I have a directory service named Casino that will hold all the information regarding the gamers that will try to connect to it in order to play a game(for example (Blackjack).Once they make the login they are... (4 Replies)
Hello Everyone
Iam working on tcp/ip programming.with some time interval server has to send data.client has to close the connection and to open the connection between the time interval.this is the scenario
when iam closing the connection in client side the connection terminates.how to... (1 Reply)
i m using sockets for setting up a connection between a server and a client.
When the clients gets connected to the server, its ip is conveyed to the server through one of the predefined structures in c library...
i save this ip address in an array....1st client's ip address goes to the zeroth... (1 Reply)
Hi,
I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused:
After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
I'm using C/ C++ with gcc on Linux. I've a server socket where accept() is called on the socket inside a while() loop. The problem I am facing is that the first call to accept is blocking (i.e., the program waits for the first connection) but as soon as I fork afterwards (so that the child process... (2 Replies)
will there be any unexpected results on looping connect call for a non blocking socket to determine the connection based on error code. I am getting connection unsuccessful intermittently and so wondering whether is the timeout 500 millisec not sufficient or looping connect cause any unexpected.
... (7 Replies)
Discussion started by: satish@123
7 Replies
LEARN ABOUT DEBIAN
io::async::loop::select
IO::Async::Loop::Select(3pm) User Contributed Perl Documentation IO::Async::Loop::Select(3pm)NAME
"IO::Async::Loop::Select" - use "IO::Async" with "select(2)"
SYNOPSIS
Normally an instance of this class would not be directly constructed by a program. It may however, be useful for runinng IO::Async with an
existing program already using a "select" call.
use IO::Async::Loop::Select;
my $loop = IO::Async::Loop::Select->new;
$loop->add( ... );
while(1) {
my ( $rvec, $wvec, $evec ) = ('') x 3;
my $timeout;
$loop->pre_select( $rvec, $wvec, $evec, $timeout );
...
my $ret = select( $rvec, $wvec, $evec, $timeout );
...
$loop->post_select( $rvec, $evec, $wvec );
}
DESCRIPTION
This subclass of "IO::Async::Loop" uses the select(2) syscall to perform read-ready and write-ready tests.
To integrate with an existing "select"-based event loop, a pair of methods "pre_select" and "post_select" can be called immediately before
and after a "select" call. The relevant bits in the read-ready, write-ready and exceptional-state bitvectors are set by the "pre_select"
method, and tested by the "post_select" method to pick which event callbacks to invoke.
CONSTRUCTOR
$loop = IO::Async::Loop::Select->new
This function returns a new instance of a "IO::Async::Loop::Select" object. It takes no special arguments.
METHODS
$loop->pre_select( $readvec, $writevec, $exceptvec, $timeout )
This method prepares the bitvectors for a "select" call, setting the bits that the Loop is interested in. It will also adjust the $timeout
value if appropriate, reducing it if the next event timeout the Loop requires is sooner than the current value.
$readvec
$writevec
$exceptvec
Scalar references to the reading, writing and exception bitvectors
$timeout
Scalar reference to the timeout value
$loop->post_select( $readvec, $writevec, $exceptvec )
This method checks the returned bitvectors from a "select" call, and calls any of the callbacks that are appropriate.
$readvec
$writevec
$exceptvec
Scalars containing the read-ready, write-ready and exception bitvectors
$count = $loop->loop_once( $timeout )
This method calls the "pre_select" method to prepare the bitvectors for a "select" syscall, performs it, then calls "post_select" to
process the result. It returns the total number of callbacks invoked by the "post_select" method, or "undef" if the underlying select(2)
syscall returned an error.
SEE ALSO
o IO::Select - OO interface to select system call
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-10-24 IO::Async::Loop::Select(3pm)