[Parti-discuss] TCP sockets (was xpra python dict error?)

Antoine Martin antoine at nagafix.co.uk
Thu Feb 19 22:59:51 EST 2009


Nathaniel Smith wrote:
> On Wed, Feb 18, 2009 at 3:51 AM, Antoine Martin <antoine at nagafix.co.uk> wrote:
>> Nathaniel Smith wrote:
>>> It'd be pretty trivial -- all the core code pretty much just wants a
>>> socket, it doesn't care where it came from -- just you'd have to deal
>>> with security and the UI and all, which is a hassle.
>> I have tested this and it worked beautifully.
>>
>> I have come up with a scheme which remains backwards compatible too (the
>> default behaviour is unchanged):
>> * instead of specifying ":displayNo", you can use "host:displayNo"
>> The server then binds to the TCP socket using the host name (ie: localhost)
>> and the display number (+ an offset).
> 
> NB, binding to localhost is not particularly sensible, because if
> someone has access to the localhost interface then they can just use
> the unix domain socket :-).
Ooops, what I meant is a network interface of the local host.
(ie: tun device)

>> The offset can be specified on the command line with a switch but defaults
>> to 10000.
> 
> 10000 seems like a suspiciously round number -- is there really no-one
> using the 10000-10030 (say) range?
Since it will be a define, I don't really care what the default is...
I just thought X server + 4000 would be enough.
According to my /etc/services file, only these ports are assigned by IANA:
amanda          10080/tcp                       # amanda backup services
amanda          10080/udp
hkp             11371/tcp                       # OpenPGP HTTP Keyserver
hkp             11371/udp                       # OpenPGP HTTP Keyserver
bprd            13720/tcp                       # VERITAS NetBackup
bprd            13720/udp
bpdbm           13721/tcp                       # VERITAS NetBackup
bpdbm           13721/udp
bpjava-msvc     13722/tcp                       # BP Java MSVC Protocol
bpjava-msvc     13722/udp
vnetd           13724/tcp                       # Veritas Network Utility
vnetd           13724/udp
bpcd            13782/tcp                       # VERITAS NetBackup
bpcd            13782/udp
vopied          13783/tcp                       # VERITAS NetBackup
vopied          13783/udp
wnn6            22273/tcp                       # wnn6
wnn6            22273/udp

So maybe 14000 is better?

>> Ditto for the client: you can specify "host:displayNo" instead of
>> "ssh:host:displayNo".
>> * We still create a file in ~$USER/.xpra except it is not a socket but a
>> plain file with the host and tcp port number in it.
>> This allows 'xpra list' to continue to work as before.
>>
>> Is this acceptable for merging?
> 
> Still not convinced that this is really useful in practice, but, eh,
> if you actually want to use it, then sure, whatever...
I do.

> Mightn't it be better if we always listened on the unix socket, and if
> we want to listen on TCP then do that in addition, rather than
> instead? Then ssh-mode and tcp-mode can be used on the same server,
> etc.
Sure. Just 2 things:
* if we do that, we lose the ability to automatically find the tcp  port 
number it is on if the offset is tweaked.  But I guess that if you tweak 
the offset when you start it, you can also apply the same offset when 
you "list" or "attach". And you can always use the socket for doing 
"stop". So that's ok.
* Not sure what the code will look like when listening to 2 sockets...
A bit more work there... Any ideas on that?

> I think I prefer the URL-like schema "tcp:host:displayno" as well,
> since tcp is not a more default mode than ssh.
Sure. done.

>> If so, how would you like me to send the patches? diff against trunk?
> 
> That would be fine.
Great. I'll get back to you with the patches asap. I'm working mostly 
offline at the moment so it might take a few days.

Thanks
Antoine



More information about the Parti-discuss mailing list