[jdev] Re: Implementing SOCKS5 file transfers

Magnus Henoch mange at freemail.hu
Tue Jun 28 10:51:16 CDT 2005

Alexander Wenckus <awenckus at mindbridge.com> writes:

> Hi:
> I am having some trouble implementing file transfers i am using both 
> exodus and PSI to test with. I am attempting to do a direct connection 
> currently and as far as I know I am implementing the byte stream 
> correctly because both PSI and Exodus are connecting to my socket 
> successfully but my problem lies in that I am not sure why they are 
> sending me what they are sending me and what to do with it. when exodus 
> connects it sends me three bytes: 5 1 0. 5 I assume is for socks version 
> 5, 1 I assume is for command 1 but shouldn't that be followed with the 
> addr type, the addr and then the port? Thats if I am reading the JEP 
> correctly. Irregardless of whatever it means I send back two bytes, 0 0, 
> as an acknowledgement of the connection but then exodus throws up an 
> error message, unable to connect to any proxies. From PSI i recieve the 
> output on the socket 5 2 0 2 and when i attempt to send the ack 0 0 i 
> get the error,  unable to connect to peer for file transfer. Can anyone 
> tell me what I am doing wrong? Any help is greatly appreciated.

Have you read http://www.faqs.org/rfcs/rfc1928.html ?  It will be
useful to you.

But to your actual problem: Exodus sending the three bytes 5 1 0.  5
is indeed the SOCKS version.  1 is the number of authentication
methods supported - each of them being identified by one byte.  The
following byte is therefore the only method supported, and 0 means "no
authentication".  You're supposed to select one method by sending 5,
X, where X is the number of the method.  Thus, send 5 0.

Psi apparently supports username/password authentication in addition
to no authentication... not sure why.


More information about the JDev mailing list