[jdev] Transfer File problem

Jose Miguel programacion5 at prodigia.com
Mon Dec 20 13:19:31 CST 2004

I'm trying to use the SOCKS5 'CONNECT' command (using RFC1928 protocol), but
I don't know how to write to the streamhost the request to connect, I've
been reading the protocol and I don't understand what format must have the
data. The protocol speaks about octets, but I have attempted several ways
and it doesn't work. Last way that I have attempted (for the method
negotiation before to CONNECT, for example):


socket_write(socket, string);

returns something and I try to read it with:


but "string2" contains something undefined.


      > - I create the socket.
      > - I do 'CONNECT' with Streamhost (other machine directly) using this
      > socket,
      > on IP address and port which streamhost sends to me.
      > - This connection completes successfully.

      This is because you're doing a normal TCP connection.

      > - I do 'CONNECT' with SHA1(streamid+initiatorjid+targetjid) hostname
      > and
      > port 0, with the same socket I use for connecting with Streamhost
      > before, it
      > returns it can't connect.

      You don't do the same thing here.  With the socket you now have open,
      you need to use SOCKS5 (RFC1928, which can be found at
      http://www.ietf.org/rfc/rfc1928.txt for reference) to request a
      connection from the streamhost to that SHA1'd string, as if you were
      connecting to a SOCKS5 proxy for general Internet use.

      A streamhost is basically pretending to be a SOCKS5 proxy server, so
      once you've connected you need to do the SOCKS5 negotiation and then
      issue the SOCKS5 'CONNECT' command -- the command in the SOCKS5
      protocol which requests a connection to a destination site -- to the
      streamhost.  /Not/ a normal TCP connect() call, a SOCKS5 command
      with the SHA1'd host as the destination field.

      Does that help?

      Rachel 'Sparks' Blackman -- sysadmin, developer, mad scientist
      "If it is not broken, give me five minutes to redesign it!"



Jose Miguel Cantero .: Dpto. Programación Prodigia Consultores S.L.
email: programacion5 at prodigia.com
Tel: (34) 957 529 016  /  Fax: (34) 957 529 143

More information about the JDev mailing list