On Wed, 2001-09-19 at 08:56, Hal E. Fulton wrote:
> Hello all...
> 
> How do I tell whether another server already
> is using a port? 
> 
> As far as I can see, starting up two TCPServers
> on the same port on the same machine 
> doesn't give an exception... 
> 
> Hal

: [bagfors / detrius]$ ; cat test.rb
#!/usr/bin/ruby

require "socket"
begin
	s=TCPServer.new("localhost",8080)
	sleep 100
rescue 
	puts "error"
end

: [bagfors / detrius]$ ; ruby test.rb&
[1] 2480

: [bagfors / detrius]$ ; ruby test.rb 
error

It sure does.

/Erik


 
-- 
Erik B?gfors               | erik / bagfors.nu
Supporter of free software | GSM +46 733 279 273
fingerprint: 6666 A85B 95D3 D26B 296B 6C60 4F32 2C0B 693D 6E32