Sandor Szücs
5/16/2009 9:33:00 PM
On 13.05.2009, at 16:41, Clemens Wyss wrote:
> Given the follwing code snippet:
>
>
> require 'socket'
> include Socket::Constants
begin
>
> socket =3D Socket.new( AF_INET, SOCK_STREAM, 0 )
> sockaddr =3D Socket.pack_sockaddr_in( 1313, 'localhost' )
> socket.bind( sockaddr )
> socket.listen( 5 )
> client, client_sockaddr =3D socket.accept
> client.puts "Hello from script one!"
> puts "The client said, '#{client.readline.chomp}'"
> client.puts "Hello from script one!"
ensure
>
> socket.close
end
Try to add these statements in your code and reboot your box,
then it should not happen.
> On my WinXP development machine this script runs as expected. =20
> Running it
> on a WinXpEmbedded machine throws a
> Too many open files - socket(2) (Errno::EMFILE)
> exception on the line
> socket =3D Socket.new( AF_INET, SOCK_STREAM, 0 )
> What could cause this exception?
Too many open files for your OS results in such an exception.
regards, Sandor Sz=FCcs
--=