targetddc
asked on
server/client pair using a udp socket
the server should receive 1 and only 1 client and print "." to the shell once a second. the socket should listen on port 9999, close the connection, remove the socket, and exit on the TERM sig.
I have included some code as follows:
#!/usr/bin/perl
use Socket;
socket(SERVER,PF_INET,SOCK _DGRAM, 0) ;
my $sin = sockaddr_un(9999,INADDR_AN Y);
bind (SERVER,$sin) || die $!;
this is where I am getting confused because I've read something similar to this
use IO::Socket;
$socket= IO::Socket::INET->new(Peer Addr =>$remote_host,
PeerPort =>9999,
Proto =>"udp",
Type =>SOCK_DGRAM) || die "Couldn't connect to $remote_host:$remote_port : $@\n";
I have included some code as follows:
#!/usr/bin/perl
use Socket;
socket(SERVER,PF_INET,SOCK
my $sin = sockaddr_un(9999,INADDR_AN
bind (SERVER,$sin) || die $!;
this is where I am getting confused because I've read something similar to this
use IO::Socket;
$socket= IO::Socket::INET->new(Peer
PeerPort =>9999,
Proto =>"udp",
Type =>SOCK_DGRAM) || die "Couldn't connect to $remote_host:$remote_port : $@\n";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
good show. Curious as to if this can be written using a server/client pair? Perhaps I'm stating the question wrong. Is there a way to write a server program and a client program?
Regards,
tddc
Thanks for your input!!!