[Twisted-Python] Could I serve normal TCP and TLS services on the same port?

Eric Hsu nkeric at gmail.com
Fri Jun 10 04:14:06 EDT 2005


Hi Justin,

Thank you for you quick reply :)

> What is the problem you are trying to solve here?
> 
> I mean, in theory, yes, you could do what you're proposing. Why do you
> want to, though?

I'm trying to write a TURN server:

http://www.ietf.org/internet-drafts/draft-rosenberg-midcom-turn-07.txt

The TURN client which is behind a NAT will ask the TURN server (with
public address) to allocate a public transport address for it to
receive data from outside.

There're two requests while the client trying to allocate a public
transport address from the TURN server:
 * Share Secret Request: over TLS; to obtain a one-time username and
passwd and keep the passwd as the share secret of both side (the
server and the client)
 * Allocate Request: to allocate a public transport address from the server

As the draft said:

"A TURN server MUST be prepared to receive  Binding (should be
Allocate - eric) Requests over TCP and UDP." (P10)

"The Allocate Request MUST be sent to the same IP address and port as the Shared
Secret Request. This is because one time passwords are expected to be
host-specific." (P20)

That means both the Share Secret Request (over TLS) and Allocate
Request will be sent to the same IP and port of the server.

Then, the draft said:

"The client SHOULD close its connection when it has completed
allocating username and passwords." (P19)

So, while the client sends the Allocate Request to the server over
TCP, the process would look like this (assuming the server is
listening on port 12345 for TLS connection):

* the client sends the Share Secret Request to server:12345 _over TLS_
and obtains a one-time username and passwd
* the client closes the TLS connection
* the client sends the Allocate Request to server:12345 _again_ to
allocate a public transport address...

It seems that I have to implement what I've mentioned in my previous mail?
I'm not a native English speaker, and TURN is only a draft, maybe I've
misunderstood something?




More information about the Twisted-Python mailing list