From mboxrd@z Thu Jan 1 00:00:00 1970 Path: quimby.gnus.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: New patch for server sockets and datagram (UDP) support. Date: 07 Mar 2002 13:58:43 +0100 Message-ID: <5x7koopm9o.fsf@kfs2.cua.dk> References: <5xwux64cxe.fsf@kfs2.cua.dk> <5xg03pyyo3.fsf@kfs2.cua.dk> <5xadtvuodz.fsf@kfs2.cua.dk> <200202280408.g1S48QG19264@aztec.santafe.edu> <5xvgchkui4.fsf@kfs2.cua.dk> <200203012123.g21LNvS20494@aztec.santafe.edu> <5xofi1p7cz.fsf_-_@kfs2.cua.dk> <87g03c5yj1.fsf@home.delysid.org> NNTP-Posting-Host: quimby2.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: quimby2.netfonds.no 1015506479 10580 195.204.10.66 (7 Mar 2002 13:07:59 GMT) X-Complaints-To: usenet@quimby2.netfonds.no NNTP-Posting-Date: 7 Mar 2002 13:07:59 GMT Cc: emacs-devel@gnu.org Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby2.netfonds.no with esmtp (Exim 3.12 #1 (Debian)) id 16ixcl-0002kY-00 for ; Thu, 07 Mar 2002 14:07:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16ixVB-0001gd-00; Thu, 07 Mar 2002 08:00:09 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by fencepost.gnu.org with smtp (Exim 3.33 #1 (Debian)) id 16ixSn-0001W7-00 for ; Thu, 07 Mar 2002 07:57:41 -0500 Original-Received: from kfs2.cua.dk.cua.dk (kfs2.local.filanet.dk [192.168.1.182]) by mail.filanet.dk (Postfix) with SMTP id 825487C047; Thu, 7 Mar 2002 12:57:40 +0000 (GMT) Original-To: Mario Lang In-Reply-To: <87g03c5yj1.fsf@home.delysid.org> Original-Lines: 48 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: quimby.gnus.org gmane.emacs.devel:1781 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1781 Mario Lang writes: > storm@cua.dk (Kim F. Storm) writes: > > > Richard Stallman writes: > > > > > If the HOST argument is nil, a server socket is opened which > > > accepts connections. The sentinel is called - with a newly > > > created process - whenever a connections is accepted. > > > > > > That sounds good to me in principle, if the details work ok. > > > > The following patch adds server socket support via open-network-stream. > > If the HOST is nil, a server socket for SERVICE is opened in listening > > state. > OK, I compiled my emacs and played a bit with it. > > Here come my issues: > > 1. How do I bind to a random port? Normally, port 0 is used > for that. I tried, it only partially works. I had Emacs listen on 42266 then, but: > > (setq my-process (open-network-stream "dcc" nil nil 0)) > (process-contact my-process) > => (nil 0 nil nil nil) > > Is it possible that process-contact would return the real port where > Emacs is listening on? Yes, I'll add a call to getsockname after bind if the port number is 0 and patch the actual port number into the process-contact list. > (BTW, the docstring of process-contact is wrong) I know :-) > > 2. How am I supposed to bind to localhost only e.g. > with this implementation??? Hmm, yes, that is a good question. Referring to my recent answer to Alex on emacs-devel, I guess the "clean" approach to this problem is to just add a 9th argument, SERVER, to open-network-connection rather than overloading the HOST argument ... -- Kim F. Storm http://www.cua.dk _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel