RE: socket application
by Jeff Slutzky other posts by this author
Jan 28 2003 9:42PM messages near this date
view in the new Beta List Site
Re: inserting text into word with OLE
|
Re: socket application
I'm glad my question was inspiring. I am trying to get this to work on my
Win2000 Workstation and it just hanging, not erroring out or anything. I
tested your code on another SCO server and it works like a charm. What
platform did you test this on? I thank you again for your help.
-----Original Message-----
From: Dirk Bremer (NISC)
Sent: Tuesday, January 28, 2003 3:11 PM
To: perl-win32-users@[...].com
Subject: Re: socket application
----- Original Message -----
From: "Jeff Slutzky" <jslutzky@[...].net>
To: <perl-win32-users@[...].com>
Sent: Tuesday, January 28, 2003 13:13
Subject: socket application
> I am attempting to make a socket server running on a Win98 platform and
> have a socket client connecting from a SCO Unix platform. What happens
is
> that I start the server and it sits waiting, I then connect from the SCO
> server with the client socket app and I detect a connection on the
Windows
> box. What doesn't happen is the client sends a "Hello" string to the
> server and the server does not read what's going through the socket.
>
> sockets.pl - running on a Win98 box.
>
> use IO::Socket;
>
> my $sock = new IO::Socket::INET (LocalHost => '192.168.2.39', LocalPort
=>
> '7801', Proto => 'tcp', Listen => 1, Reuse => 1,);
> die "Could not create socket: $!\n" unless $sock;
> my $new_sock = $sock->accept();
> print "accept\n";
> while($new_sock) {
> print $_;
> }
> close($sock);
Jeff,
I played around with your code a bit, never having used sockets before, and
came up with this functioning version of your program.
my $Socket;
my $RDR = new IO::Socket::INET (LocalHost => 'XXX.XXX.XXX.XXX', LocalPort
=> '7801', Proto => 'tcp', Listen => 1, Reuse => 1);
die("Could not create socket: $!") unless($RDR);
while($Socket = $RDR-> accept())
{
while (<$Socket> ) {chomp; print(">$_<\n")}
}
close($RDR);
close($Socket);
To all,
Jeff's initial code inspired me to play around a bit with an idea I've had
for a while. I would like to able kill and then restart certain processes
on
another machine. Using code similar to above, I have tested it on the other
machine and it does receive messages sent from my machine. Both machines
are
Win2K. I would send predefined commands to the other machine to kill a
specific process, then update the programs on the other machines by an
external and manual process, and then would send other predefined commands
to restart the programs. I think I can handle sending and receiving the
messages and the restarting of the programs. The one piece of information I
will need is how to kill the processes on the other machine. This can be
done from the receiving socket program that will be executing on the other
machine. Both of the processes I am interested in killing run in separate
windows with specific window titles. Which is the best way to locate these
processes and then kill them? Note that neither of the processes on the
remote machine are written in Perl. Your suggestions will be appreciated.
Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters
USA Central Time Zone
636-922-9158 ext. 8652 fax 636-447-4471
dirk.bremer@[...].cc
www.nisc.cc
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Jeff Slutzky
Dirk Bremer (NISC)
|