Ok what i am trying to do with my script i send a poll and receive a reply and read that reply. I have the Poll work properly but what i need help with is trying to convert the reply from ascii to regular text.
My reply consist of 30 different variables and i need them to be separated. my code so far is. - #!/usr/bin/perl
-
-
print "Content-type:text/html\n\n";
-
use IO::Socket;
-
-
#Poll
-
my $header = 'Art-Net';
-
my $space = ' ';
-
my $Prover = chr(0x0e);
-
my $filler = chr(0x00);
-
my $ttm = chr(0x02);
-
my $ID = $header.$filler;
-
-
my $ArtPoll = $ID.$filler.$space.$filler.$Prover.$ttm.$filler;
-
-
-
#My Reply.
-
my $T_ArtPollReply = pack("A8 S C C C C C C C C C S C18 C64 C64 C C C C C C C C C C C C C C C6 C32",
-
$ID,
-
$OpCode,
-
$BoxAddr,
-
$VersionInfoH,
-
$VersionInfo,
-
$SubSwitchH,
-
$SubSwitch,
-
$OemH,
-
$Oem,
-
$UbeaVersion,
-
$Status,
-
$EstaMan,
-
$ShortName,
-
$LongName,
-
$NodeReport,
-
$NumPortsH,
-
$NumPorts,
-
$PortTypes,
-
$GoodInput,
-
$GoodOutput,
-
$Swin,
-
$Swout,
-
$SwVideo,
-
$SwMacro,
-
$SwRemote,
-
$Spare1,
-
$Spare2,
-
$Spare3,
-
$Style,
-
$Mac,
-
$Filler,
-
);
-
-
$Node_Ip = '2.0.0.1';
-
-
my $poll = IO::Socket::INET->new(
-
PeerAddr => $Node_Ip,
-
PeerPort => "6454",
-
Proto => "udp",
-
LocalPort => "6454",
-
);
-
-
sub ArtPoll {
-
$poll->send($ArtPoll);
-
print "ArtPoll sent.\n<hr>";
-
-
sub Reply {
-
$poll->recv($T_ArtPollReply,250);
-
print $T_ArtPollReply;
-
}
-
&Reply;
-
}
-
-
&ArtPoll;
-
When i run it i try to print the reply but i get[HTML]<br>[/HTML] Art-Net??!??6? ??ÒLATest1??? ??????????Test Node ??????????????? ??????????????? ??????????????? ?????????#0001 [0019] Power On Tests Pass??????????? ??????????????? ???????€€????? ?€€?????????? ??????¦?
i know i have to do something with unpack or something but not sure if some one could help me out it would be very helpful.
0 1432 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Johannes |
last post by:
Hi,
I tried to pack eight integer values and one string into one binary
string, which I would like to store in a mysql db.
I encountered two problems doing this:
1)
$this->packed = pack('N8A*', $this->value1, $this->value2,
$this->value3, $this->value4, $this->value5, $this->value6,
$this->value7, $this->value8, $this->stringvalue);
|
by: Sergey Dorofeev |
last post by:
I can use string.unpack if string in struct uses fixed amount of bytes.
But is there some extension to struct modue, which allows to unpack
zero-terminated string, size of which is unknown?
E.g. such struct: long, long, some bytes (string), zero, short, short,
short.
|
by: Stacy Mader |
last post by:
Greetings all,
I have a VMS binary file with weather data. The record
on each line is 1xint(8) 12xint(2)
Using the perl unpack function, I can decode the
binary file like this:
<snip>
|
by: p.lavarre |
last post by:
Can Python not express the idea of a three-byte int?
For instance, in the working example below, can we somehow collapse the
three calls of struct.pack into one?
08 12 34 56 80 00
I ask because I'm trying to refactor working code that is concise:
08 12 34 56 80 00
|
by: Steve |
last post by:
Are there any gurus of the pack/unpack world out there that can help me
with this one?
I have an encrypted string which I'm reading from a zipped file. It was
written using
pack ( "la" . strlen (encrypted), strlen (encrypted), strlen (encrypted))
most of the time, it decrypts correctly when I unpack as...
| |
by: andmarti |
last post by:
If I build a strict with:
import struct
print struck.pack ('i', 1)
it returns a '\n'.
What's wrong with it???
:(
--
|
by: praveen0437 |
last post by:
hi
i know about format argument in pack and unpack like b h i etc but in some cases i am getting < or = symbols along with them what does they signifies
for example struct.pack( "<cI", 'n', var1 )
|
by: tmp123 |
last post by:
Hello,
Thanks for your time.
After review the "struct" documentation, it seems there are no option
to pack/unpack zero terminated strings.
By example, if the packed data contains: byte + zero terminated string
+ zero terminated string + byte, it seems no possible to unpack it
using "struct".
|
by: joe shoemaker |
last post by:
If you have the following:
data = unpack('>L', sock.recv(4))
Does this line of code means that incoming data is big endian and
unpack it to endianess of local machine? If local machine is little
endian, then big endian is automatically converted to little endian
format?
thank you.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |