[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: Re: perl help
Thanks sreeji, for the help..
Well my problem is that the other part was written in
java(java application), and actually i am writing a cgi
script which suppose to talk to the java application over
since i can't change the way the java application was
written, all i can do is change my code.
i need to form packet of 3 bytes , containing 1 byte of
operation code and rest two byte for data.
similarly i get 3 bytes packet from the other side
containing status info.
the problem starts here, if i send op code 1 it reaches
there as 48, same thing happen with data,
but now i found out that when i send \1 it reaches ther
as 1, but still i am unable to figure out how to send the
for reciving..also i am facing the same problem..all i am
reciving is all junk character.
I hope this explanation is ok, please help me
out...really got struct..doing all sort of permutation
and combination..nothings seems to work...
------------- Original Message --------------
On 13 Jan 2001, Moyukh wrote:
> Hi all,
> well i am new to perl programming..i am trying out some
> socket programming..
> when i send 0 (zero) it reaches as ascii zero that is 48,
> even if i try to send 0x0 then also it goes as ascii zero.
> what ever i send it all goes as ascii, the second
> how to cover the data recived as ascii character to int....
Well, in perl the difference between a character & an
dim. Perl treats them appropriately based on the context.
So you can have
$String = "1000"; $String++;
During the string assignment, 1000 is considered as a
string. But the ++
operator treats it as a number, without you explicitly
Now, coming to your problem, what exactly is your
requirement ? Why do u
want to convert from ascii 2 integer ..? You can simply do a
syswrite() on one end (or send() if u're using UDP) &
sysread (or recv) on
the other end. U'll always get the same data. Socket
programming in perl
is damn easy, if u use the standard modules, such as
If u want I can send u sample code.
Find out more about this and other Linux India
mailing lists at http://lists.linux-india.org/
Chat with your friends as soon as they come online. Get Rediff Bol at