• Re: Socks + NIO possible?

    From weiqi fan@21:1/5 to All on Wed Oct 11 20:31:05 2023
    在 2009年4月21日星期二 UTC+8 01:50:06,<Christian> 写道:
    Peter Duniho schrieb:
    On Sat, 18 Apr 2009 19:47:08 -0700, Christian <fake...@xyz.de> wrote:

    [...]
    My hope was that there was sort of an alike way to handle Proxys
    without having to change all code where SocketChannels are in use.

    There just is no .connect() method for socketChannel that allows for a
    proxy..

    Well, I admit I haven't used it. But as I mentioned, it appears to me
    that you can use the ProxySelector class (or more specifically, your own implementation of the class) to globally direct all Socket i/o to use a particular proxy server.

    I agree that the restriction on SocketChannel, where (as the docs say)
    "It is not possible to create a channel for an arbitrary, pre-existing socket", means you can't construct a Socket to use a specific proxy.
    But as long as you can deal with setting it on a global basis (at least temporarily, while you create the SocketChannel you need), it seems like it would work.

    Pete
    Problem I have is: SocketChannel seems to ignore global settings.
    It just doesn't work here.
    Christian
    Have you resolved this problem?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)