Re: Can transport.write() to hostname instead of IP address?

Adi Roiban <[email protected]>
Newsgroups gmane.comp.python.twisted
Message-ID <CAFycZ9dMwU5Xd7wQNOVrs32Zvh5+hL5gvdNr-+NtbLVRFiOH=w@mail.gmail.com>
On Fri, 17 Aug 2018 at 01:25, Sean DiZazzo <[email protected]> wrote:
>
> Hi all!
>
> After I start a reactor connecting to a specific hostname and port, I do my thing and then call transport.write() to send the data to the peer.
>
> From what I can tell, though, the hostname is resolved, and the data is written back to the ip address itself, instead of the hostname I started the reactor with.
>
> This is a problem in my case because we are using nginx's ssl_preread server_name directive to route several different streams all coming in on the same ip address.
>
> So the write() method needs to explicitly use the hostname to route the packet properly.
>
> So... Is there any way to have transport.write() use the hostname given instead of it's resolved IP address? Or am I missing something?
>

I assume you are using TCP here.

I guess that you are missing something.

If you want each write to go over its own way / route and have the
hostname re-resolved you should open + write + close a connection for
each write.

But I think that there is something else there and this is now what you want :)
Do you use HTTP or have a custom protocol?

Cheers,

Adi Roiban

_______________________________________________
Twisted-Python mailing list
[email protected]
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.