Skip to content

Commit

Permalink
added example for listening on random port
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 11, 2014
1 parent e08e797 commit bf5cd13
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -564,6 +564,13 @@ as L<Mojo::IOLoop::Server/"listen">.
...
});
# Listen on random port
my $id = Mojo::IOLoop->server({address => '127.0.0.1'} => sub {
my ($loop, $stream, $id) = @_;
...
});
my $port = Mojo::IOLoop->acceptor($id)->handle->sockport;
=head2 singleton
my $loop = Mojo::IOLoop->singleton;
Expand Down

0 comments on commit bf5cd13

Please sign in to comment.