RUDP, shared libraries, etc.
Tue Mar 29 10:41:47 CEST 2005
Joel Reymont writes:
> Is there a reliable UDP implementation for Erlang?
Not that I know of. Though I know people have played around with
implementing parts of TCP in Erlang (most recently: Luke Gorrie), but
I'd guess that none of that is intended/ready for serious use.
> I would like my server
> to support at least 10,000 simultaneous users and it seems that I could
> only do 1024 with gen_tcp due to a Unix select limitation.
A relatively conservative way around that limitation is to run
multiple Erlang VMs on the same machine. Erlang is intended for that
sort of design. A little bonus would be that your application would
then be ready to scale to multiple machines.
> This seems like a non-issue with UDP but what's the best way to ensure
> that messages are ordered and positively delivered? The documentation
> states that messages sent from process A to B are indeed ordered but does
> this apply to UDP?
UDP makes few guarantees. A UDP message may be quietly lost in
transmission. A UDP message might arrive twice. UDP messages might
arrive out-of-order. This is a property of UDP, it's not
If you run UDP packets over the big, bad internet, you'll see the above
happening, especially "quietly lost".
If you run UDP packets over a switched ethernet, you'll rarely, if
ever, see UDP misbehaving. UDP will seem reliable. YMMV.
> I would like to build the user interface using the Torque Game Engine
> (www.garagegames.com) and it uses a custom main on Windows and Mac OSX
> which makes it very hard to build it into a shared library to be called
> from Erlang. What is the best way to interface with Erlang here?
There are several ways to interface Erlang, each has advantages and
disadvantages. I'd suggest starting with something simple first,
e.g. running the two as seperate OS processes and communicating over a
TCP socket. Invent your own simple protocol.
If you want to make things more complicated, take a look at
erl_interface. But be warned: the mailing list is littered with the
corpses of beginners who have used erl_interface or linked-in drivers
without understanding them and then become completely baffled by the
resulting memory-corruption problems.
> Can I make the Erlang runtime and my code into a shared library
> to be loaded into C++?
For practical purposes: no.
More information about the erlang-questions