Zinc: Detect failed binds

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

Zinc: Detect failed binds

Mark Smith
Hi :),

Does anyone know if there's a way to detect if a Zinc Server doesn't bind to a port,  (probably because there's already a server listening on that port), and signal an error?

Thanks a lot,

Mark
Reply | Threaded
Open this post in threaded view
|

Re: Zinc: Detect failed binds

Sven Van Caekenberghe
Mark,

On 13 Jun 2012, at 12:09, Mark Smith wrote:

> Hi :),
>
> Does anyone know if there's a way to detect if a Zinc Server doesn't bind to a port,  (probably because there's already a server listening on that port), and signal an error?
>
> Thanks a lot,
>
> Mark

Good question.

Try

        server isRunning & server isListening

as is done by most unit tests using #withServerDo:

HTH,

Sven

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill


Reply | Threaded
Open this post in threaded view
|

Re: Zinc: Detect failed binds

Mark Smith
Thanks Sven. That's working now :).

On 13 Jun 2012, at 11:22, Sven Van Caekenberghe wrote:

> Mark,
>
> On 13 Jun 2012, at 12:09, Mark Smith wrote:
>
>> Hi :),
>>
>> Does anyone know if there's a way to detect if a Zinc Server doesn't bind to a port,  (probably because there's already a server listening on that port), and signal an error?
>>
>> Thanks a lot,
>>
>> Mark
>
> Good question.
>
> Try
>
> server isRunning & server isListening
>
> as is done by most unit tests using #withServerDo:
>
> HTH,
>
> Sven
>
> --
> Sven Van Caekenberghe
> http://stfx.eu
> Smalltalk is the Red Pill
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Zinc: Detect failed binds

Ben Coman
In reply to this post by Mark Smith
Mark Smith wrote:
> Hi :),
>
> Does anyone know if there's a way to detect if a Zinc Server doesn't bind to a port,  (probably because there's already a server listening on that port), and signal an error?
>
> Thanks a lot,
>
> Mark
>
>  
As a backup plan... why not from one code path (perhaps requiring a fork)
1. start Zinc Server
2. generate random magic number
3. connect to server as a client requesting magic number.
4. check returned magic number matches the one from (2)