gen_server

Björn Bylander bjorn@REDACTED
Fri Aug 2 16:04:36 CEST 2002


Sean Hinde wrote:
> 
>>>Is there any way to design a process using passive sockets 
>>
>>so that it 
>>
>>>supports code replacement without using shortish timeouts to recv?
>>>The process would mostly spend time in a passive recv, much 
>>
>>like you 
>>
>>>describe in the last paragraph.
>>>
>>
>>Never mind, I found the thread "gen_server, gen_tcp question".
> 
> 
> Without re-reading that thread, there is a very neat mechanism for this
> where a socket can be set to mode {active, once}. The next packet will be
> sent to the process sitting in it's normal receive loop but no more will be
> sent until inet:setops(S, [{active, once}]) is set again. This provides the
> control aspect of gen_tcp:recv without the need to block.

Oh, that would be a recent addition then? The active option to setopts 
is documented as only Boolean even in the online documentation.
Really nice anyway, I'll try it out.

> 
> Sean
> 
> 
> 
> NOTICE AND DISCLAIMER:
> This email (including attachments) is confidential.  If you have received
> this email in error please notify the sender immediately and delete this
> email from your system without copying or disseminating it or placing any
> reliance upon its contents.  We cannot accept liability for any breaches of
> confidence arising through use of email.  Any opinions expressed in this
> email (including attachments) are those of the author and do not necessarily
> reflect our opinions.  We will not accept responsibility for any commitments
> made by our employees outside the scope of our business.  We do not warrant
> the accuracy or completeness of such information.

/Björn




More information about the erlang-questions mailing list