Hello,

Sorry to bother~~~ I'm trying to make a websocket implementation and the result is below:

>perl client.pl

client receive message: #client say : Hello, world!

#client receive message: ##client receive message:

#client say : Hello, world!

#client receive message: #client say : Hello, world!

#client receive message: #client say : Hello, world! ....

As you see, it loop infinitely sending messages with server if I used perl interpreter to execute(type 'perl client.pl'). But when I used perl2exe to compile my program to EXE and then execute, the client.exe can not loop anymore. I do not know what happened because I did not meet any error message. The result as below:

>client.exe

>

My code(client.pl) as below:

#!/usr/bin/perl use strict; use IO::Async::Loop; use IO::Async::Loop::Select; use IO::Async::Loop::Poll; use IO::Async::Notifier; use Net::Async::WebSocket::Client; use Net::Async::WebSocket::Protocol; use IO::Async::Internals::Connector; use IO::Async::Function; use IO::Async::Timer; use IO::Async::Routine; use IO::Async::ChildManager; my $client = Net::Async::WebSocket::Client->new( on_frame => sub { my ( $self, $frame ) = @_; print "client receive message: #$frame#"; }, ); # Define websocket Host & Port my $HOST = "localhost"; my $PORT = "8080"; my $loop = IO::Async::Loop->new; $loop->add( $client ); while( 1 ) { $client->connect( url => "ws://$HOST:$PORT/", )->then( sub { $client->send_frame( "client say : Hello, world!\n" ); })->get; } $loop->run;

In reply to Perl2exe Problem (Websocket) by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.