[erlang-questions] Can gen_tcp/inets store connection-specific user state?

Tony Arcieri <>
Mon Jul 19 19:51:47 CEST 2010


On Fri, Jul 16, 2010 at 6:41 AM, Juan Jose Comellas <>wrote:

> The beauty of Erlang is precisely that you don't have to worry about this.


That seems to be a common reaction when I pose a question in this manner.  I
would suggest that round tripping lots of explicit state is very much the
norm of Erlang, and while that's a bit ugly IMO, here I'm running into a
case where I'd like to do it where it isn't possible.

Why are you worried about having one Erlang process per connection?
>

I already spelled that out in my previous email, but beyond that, they are
unneeded in this case and add additional overhead.  The requirement to use a
process is imposed only by the design of the gen_tcp/inets APIs.

It seems like attaching a single piece of immutable state to each connection
is going to add a lot of complexity.  In order to expose a sequential,
side-effect based API to the end user, I'm going to have to proxy all
communication between inets and the end user, and also provide process
management.

Let's just say I consider this an unparsimonious and inelegant solution with
more overhead than leveraging the end-to-end potential for associating
connection specific state with particular sockets.

-- 
Tony Arcieri
Medioh! A Kudelski Brand


More information about the erlang-questions mailing list