[erlang-questions] How to manage blocking accept for many sockets?
Wed May 20 01:31:51 CEST 2009
> You could always put the blocking call into it's own process. When a
> connection occurs, change the port's owner and send the port in a
> message. (And open the port in passive mode to make sure messages
> aren't received before switching the owner.)
The problem I have with this model is that it becomes unwieldy to manage a large set of listeners.
I am building a TCP port forwarding concentrator which listens on thousands of IP addresses. It seems I need a process per listening socket unless I use async_accept.
To follow from Constantin's original question: is there a clean way for me to manage (ie. add and remove) a large number of TCP listeners?
Internally erlang can make use of epoll-like syscalls. The asynchronous nature of epoll fits well with the erlang messaging model. Is there an interface which exposes this style of IO to the erlang programmer; ie. many (listening and connected) sockets managed through one object?
Need a Holiday? Win a $10,000 Holiday of your choice. Enter now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzk3NwR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=14600t3ni/**http%3A//au.rd.yahoo.com/mail/tagline/creativeholidays/*http%3A//au.docs.yahoo.com/homepageset/%3Fp1=other%26p2=au%26p3=mailtagline
More information about the erlang-questions