Ask coding questions

← Back to all posts
How can I use ping within a repl?
Froggo-School

Hi, I am looking to use the ping command from within a repl. In linux, the ping, host, (etc.) commands are preinstalled. As apt/apt-get requires superuser privs, and there is no package manager for bash repls, is there any way to install/use ping? Thanks.

Voters
Froggo-School
Comments
hotnewtop
SixBeeps

Hmm, could you substitute your usage of ping with curl? I can't even begin to think of a way to install ping in a Repl.

Froggo-School

@SixBeeps Sadly, no. I am going to use this for a multiplayer game (on a port other than 80). Using curl <server>:<port> just returns a "Connection refused" error, and not any millisecond values. Thanks for your comment, though.

Froggo-School

Just for reference, the game will be built in html/javascript, with a python webserver.

SixBeeps

@Froggo-School Take the time before calling curl, call curl, then take the time again.

Froggo-School

@SixBeeps I'd like to use a javascript implimentation of that (to run inside a webpage), instead of on the backend.

SixBeeps

@Froggo-School Are you telling me you originally planned on running ping on the client side?