Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi bh_perl,

First, how can we know what the result of the following is? ...

my $dir = "/data/input"; my $data = `cat $dir/cdr-data.dat |sed 's/ //g'`; my $binary = pack ("H*", $data);

That's a file on your system, which we have no access to.

You also haven't said anything about the results you get back, which makes it impossible to know how it's failing for you.

Do you have access to the server-side code? If so, try logging to a local file what's happening on the server side. Make sure you log each step, so if something fails you'll know exactly where in the code it happened.

If you look at the documentation for recv it suggests perusing "UDP: Message Passing" in perlipc for examples, and referring to that section of the perlipc docs shows an example of recv where the error is displayed:

$hispaddr = recv(SOCKET, $rtime, 4, 0) || die "recv: $!";

What happens if you do the same in your code?, ie.:

$socket->recv($response, 1024); defined($response) || die "recv: $!";

Update: looking closer at recv shows that it may be the return value from $socket->recv(...) that you want to check for undef, ie:
$socket->recv($response, 1024) || die "recv: $!";

say  substr+lc crypt(qw $i3 SI$),4,5

In reply to Re^3: How to sent binary data in socket programming ? by golux
in thread How to sent binary data in socket programming ? by bh_perl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-19 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found