AryanSinha has asked for the wisdom of the Perl Monks concerning the following question:
Please help me out in this. I am completely new to Perl and Just need this small task to finsih to complete rest of my project based on hradwares working on different platform.#!/usr/bin/perl #udpclient.pl use IO::Socket; use warnings; use Time::HiRes qw (sleep); my ($socket,$data); #my $in_file_name = $ARGV[0]; $in_file_name='C:\Users\Aryan Sinha\Documents\RecordedData.csv'; open(INFILE,"<",$in_file_name) or die "Not able to open test file $!"; $socket = IO::Socket::INET->new (PeerAddr => '21.22.32.214', PeerPort => 5005, Type => SOCK_DGRAM, Proto => 'udp') or die "ERROR in + Socket Creation : $!\n"; while (<INFILE>) { chomp; if($. != 1) #skip first line { $data=$_; # Data would be in String format my @tempData = split(',', $data); #---------------Description of the problem ------------------- +------- # 1) I have a CSV File of numeric values which I need to send +line by line . # 2) $data has a single line of values in String format . Exam +ple : '2,3.4,2323.23,980.3,235.1' # 3) @tempData is an Numeric array where I stored the values s +pliited from $data . Example : (2,3.4,2323.23,980.3,235.1) # # 4) Now importantly , I need to send the data as a "packet of + Numeric values" at a time using SEND SOCKET command in PERL.The Orde +r of Values should not be changed # #-----------------End of the Description --------------------- +--------- $socket->send($DATA_to_be_SENT); sleep(0.25); } } $socket->close();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Send a UDP Packet with bunch of numbers in PERL?
by NetWallah (Canon) on Aug 18, 2016 at 17:43 UTC | |
by AryanSinha (Initiate) on Aug 18, 2016 at 19:14 UTC | |
by pryrt (Abbot) on Aug 18, 2016 at 19:41 UTC | |
by AryanSinha (Initiate) on Aug 18, 2016 at 19:55 UTC | |
by AryanSinha (Initiate) on Aug 18, 2016 at 20:24 UTC | |
by pryrt (Abbot) on Aug 19, 2016 at 00:55 UTC | |
|
Re: Send a UDP Packet with bunch of numbers in PERL?
by Mr. Muskrat (Canon) on Aug 18, 2016 at 21:31 UTC | |
|
Re: Send a UDP Packet with bunch of numbers in PERL?
by neilwatson (Priest) on Aug 18, 2016 at 17:47 UTC |