[Perl-unix-users] Socket connections
by Glen Pierce other posts by this author
Jun 6 2007 11:37AM messages near this date
Re: [Perl-unix-users] allowing for a custom time window specification and then calculating if a date/time is within its range
|
Re: [Perl-unix-users] Socket connections
Hi All,
I am hoping someone here can help me. First I will say I don't have a
lot of experience setting up socket connections. I am trying to set up
a socket connection using IO::Socket. I want to establish a socket
connection and keep it established. Can this be done? If so, what is
the best way to do it? Also, is there a way to test to see if there is
a socket connection already open on a certain port, other than netstat?
Something internal to perl or the module itself is what I was looking
for. Below is the snipet of code I am using.
Use IO::Socket;
if (! $socket){
$socket = IO::Socket::INET-> new(PeerAddr => $ host, PeerPort => $
port, Proto => $protocol);
$socket-> bind();
}
if ($socket) {
...do something like send data
}else{
...make sure no connections on port I want to use and then
open a new socket connection
}
Thanks,
Glen.
Thread:
Glen Pierce
Bill Luebkert
|