emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New patch for server sockets and datagram (UDP) support.


From: Kim F. Storm
Subject: Re: New patch for server sockets and datagram (UDP) support.
Date: 07 Mar 2002 13:58:43 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Mario Lang <address@hidden> writes:

> address@hidden (Kim F. Storm) writes:
> 
> > Richard Stallman <address@hidden> 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 <address@hidden> http://www.cua.dk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]