Re: socket application

2003-01-28 Thread Dirk Bremer \(NISC\)
- Original Message -
From: "Jeff Slutzky" <[EMAIL PROTECTED]>
To: "'Dirk Bremer (NISC)'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, January 28, 2003 15:42
Subject: 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.
>


Jeff,

I tested both the sender and receiver scripts on Win2k boxes. No Unix
available to play with.

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
USA Central Time Zone
636-922-9158 ext. 8652 fax 636-447-4471

[EMAIL PROTECTED]
www.nisc.cc

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



RE: socket application

2003-01-28 Thread Jeff Slutzky
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: [EMAIL PROTECTED]
Subject:        Re: socket application

- Original Message -
From: "Jeff Slutzky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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

[EMAIL PROTECTED]
www.nisc.cc

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: socket application

2003-01-28 Thread Dirk Bremer \(NISC\)
- Original Message -
From: "Gerber, Christopher J" <[EMAIL PROTECTED]>
To: "'Dirk Bremer (NISC)'" <[EMAIL PROTECTED]>
Sent: Tuesday, January 28, 2003 15:25
Subject: RE: socket application


> Dirk,
>
> I had hacked together something like this in C at one point.  I think I
have
> a copy of the source code at home.  I'll see if I can find it and then we
> can talk about turning it into Perl.  If I can't find it, I should at
least
> be able to find the API calls.  Are the processes that you're killing
> regular apps, or services.  (Services would be easier.)
>
> Chris
>

Chris,

They are not services and written in the WinBatch scripting language that
supports the creation of its own windows. They are not console windows per
se, but similar. I have used something in Win32::GUI to locate a particular
window by its title, but have no idea how to kill the window once it has
been located.

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
USA Central Time Zone
636-922-9158 ext. 8652 fax 636-447-4471

[EMAIL PROTECTED]
www.nisc.cc

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: socket application

2003-01-28 Thread Dirk Bremer \(NISC\)
- Original Message -
From: "Jeff Slutzky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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

[EMAIL PROTECTED]
www.nisc.cc

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: socket application

2003-01-28 Thread Alan Dickey
Jeff Slutzky wrote:
> 
> 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.
> 
> I'm attaching the code, and it is pretty plain jane.  If anyone can point
> me in the right direction I would appreciate it.
> 
> ++
> 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);
> 

how about using the recv method on $new_sock:

$new_sock->recv($inbuf,$inbuf_length,0) or croak "$0 - can't recv: $!";

-- 
Alan F. Dickey - Interaction and Realization
http://www.intac.com/~afdickey
mailto:[EMAIL PROTECTED]
VOX: 908-273-3232 Cell: 908-334-0932

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs