| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| problem: excecutes only DATA string but nor IO1 and IO0. script: #!\usr\bin\perl -w use IO::Socket; use diagnostics; use strict; use POSIX qw(strftime); my $remote_host = ""; my $remote_port = ""; my ($handle, $send_data,$send_i1,$send_i0,$count); $count=0; $handle= IO::Socket::INET->new( PeerAddr => $remote_host, PeerPort => $remote_port, Proto => "tcp", Type => SOCK_STREAM ) || die "Couldn't connect to $remote_host:$remote_port: \n"; print STDERR "[Connected to $remote_host:$remote_port]\n"; DATA: while(<$handle=1>) { for($count=0;$count<180;$count++) { $send_data = self define string; $handle-> send($send_data); $count=0; sleep(180); } } IO1: while(<$handle=1>) { for($count=0;$count<240;$count++) { $send_i1 = self defined string $handle-> send($send_i1); $count=0; sleep(240); } } IO0: while(<$handle=1>) { for($count=0;$count<360;$count++) { $send_i0 = self defined string; $handle-> send($send_i0); $count=0; sleep(360); } } |
|
#2
| |||
| |||
| Arun wrote: Perhaps you try to explain to us and to yourself, what this line is supposed to do: > DATA: while(<$handle=1>) Josef -- These are my personal views and not those of Fujitsu Siemens Computers! Josef Möllers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize (T. Pratchett) Company Details: http://www.fujitsu-siemens.com/imprint.html |
|
#3
| |||
| |||
| Arun schreef: > #!\usr\bin\perl -w > [...] > use strict; It won't solve your real problem, but it sure looks better: #!/usr/bin/perl use strict; use warnings; -- Affijn, Ruud "Gewoon is een tijger." |
|
#4
| |||
| |||
| Arun <sajapuram.arun.prakash@gmail.com> wrote: > problem: excecutes only DATA string but nor IO1 and IO0. I would like to hear any answert to Josef Moellers's question too. Meanwhile: > #!\usr\bin\perl -w Use C<use warnings;> instead. > use IO::Socket; > use diagnostics; Use C<perldoc perldiag> instead. > use strict; > use POSIX qw(strftime); > my $remote_host = ""; > my $remote_port = ""; > my ($handle, $send_data,$send_i1,$send_i0,$count); > $count=0; > $handle= IO::Socket::INET->new( PeerAddr => $remote_host, > PeerPort => $remote_port, I'm not an B<IO::Socket::INET> expert, but I suppose you are going to connect to empty port at empty address. > Proto => "tcp", > Type => SOCK_STREAM > ) > || die "Couldn't connect to $remote_host:$remote_port: \n"; > print STDERR "[Connected to $remote_host:$remote_port]\n"; > DATA: while(<$handle=1>) *SKIP* > $send_data = self define string; BTW, copy-paste your code. Don't retype. *SKIP* > IO1: while(<$handle=1>) *SKIP* > IO0: while(<$handle=1>) *SKIP* I would like to know your intentions too. What you really achieved is: 23:38:09 69 [0:0]$ perl -mIO::Handle -wle ' $x = new IO::Handle; print <$x=1>' IO::Handle=GLOB(0x814ed90)=1 I believe, that since filehandles aren't supposed to be assigned while reading from them, Perl treats your construct as globbing (instead of reading). Surprise? C<perldoc -f glob> has more. -- Torvalds' goal for Linux is very simple: World Domination |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.