How can we verify that a daemon is listening on a TCP socket

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How can we verify that a daemon is listening on a TCP socket

stepharo
Hi guys

I would like to know if a daemon (mongo) is listening on a given TCP socket?

Stef

Reply | Threaded
Open this post in threaded view
|

Re: How can we verify that a daemon is listening on a TCP socket

Sven Van Caekenberghe-2
Depending on the protocol you just connect to it and see if that works ;-)

With a short timeout, of course.

I would just use the matching client in Pharo.

> On 04 Dec 2015, at 16:07, stepharo <[hidden email]> wrote:
>
> Hi guys
>
> I would like to know if a daemon (mongo) is listening on a given TCP socket?
>
> Stef


Reply | Threaded
Open this post in threaded view
|

Re: How can we verify that a daemon is listening on a TCP socket

Robert Withers
In reply to this post by stepharo
 > netstat -a | grep LISTEN | grep <port>

that should get you there.

Robert

On 12/04/2015 10:07 AM, stepharo wrote:
> Hi guys
>
> I would like to know if a daemon (mongo) is listening on a given TCP
> socket?
>
> Stef
>


Reply | Threaded
Open this post in threaded view
|

Re: How can we verify that a daemon is listening on a TCP socket

Blondeau Vincent
In reply to this post by stepharo
Hi,

You should try
netstat -uta
in a shell console.
And see if there is a localhost port opened on what you expect.

I have not tested on my laptop but it should work.

Vincent

> -----Message d'origine-----
> De : Pharo-users [mailto:[hidden email]] De la part de
> stepharo
> Envoyé : vendredi 4 décembre 2015 16:07
> À : Any question about pharo is welcome
> Objet : [Pharo-users] How can we verify that a daemon is listening on a TCP
> socket
>
> Hi guys
>
> I would like to know if a daemon (mongo) is listening on a given TCP socket?
>
> Stef



Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
Reply | Threaded
Open this post in threaded view
|

Re: How can we verify that a daemon is listening on a TCP socket

NorbertHartl
In reply to this post by stepharo
> Am 04.12.2015 um 16:07 schrieb stepharo <[hidden email]>:
>
> Hi guys
>
> I would like to know if a daemon (mongo) is listening on a given TCP socket?

Of course it is :) Default port is 27017


Norbert
Reply | Threaded
Open this post in threaded view
|

Re: How can we verify that a daemon is listening on a TCP socket

stepharo
In reply to this post by stepharo
Et voilà ;-)

Avec MongoTalk :

server := Mongo default.
[ server open ] on: ConnectionTimedOut do: [ :e | self error: 'local
mongo server is not running' ].
server isOpen

Avec des sockets uniquement :

[ stream := SocketStream openConnectionToHostNamed: 'localhost' port:
27017 ]
     on: ConnectionTimedOut
     do: [ :e | self error: 'local mongo server is not running' ].
stream


Luc





Le 4/12/15 16:07, stepharo a écrit :
> Hi guys
>
> I would like to know if a daemon (mongo) is listening on a given TCP
> socket?
>
> Stef
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How can we verify that a daemon is listening on a TCP socket

Robert Withers
Wouldn't it be wonderful to have netstat, ifconfig, route, traceroute, top and other system/networking utilities in Squeak/Pharo. I can see a use for manipulating the routing tables from inside our wonderful world.

bonne soirée,
Robert

On 12/05/2015 11:54 AM, stepharo wrote:
Et voilà ;-)

Avec MongoTalk :

server := Mongo default.
[ server open ] on: ConnectionTimedOut do: [ :e | self error: 'local mongo server is not running' ].
server isOpen

Avec des sockets uniquement :

[ stream := SocketStream openConnectionToHostNamed: 'localhost' port: 27017 ]
    on: ConnectionTimedOut
    do: [ :e | self error: 'local mongo server is not running' ].
stream


Luc





Le 4/12/15 16:07, stepharo a écrit :
Hi guys

I would like to know if a daemon (mongo) is listening on a given TCP socket?

Stef