[jdev] Re: Implementing SOCKS5 file transfers

Alexander Wenckus awenckus at mindbridge.com
Wed Jun 29 11:37:40 CDT 2005

Hi all:

I am thoroughly confused at this point in getting file transfer to work. 
I have been able to receive a file successfully but I am still unable to 
send a file. I complete successfully the authentication method 
negotiation as specified in rfc 1928 and then proceed to wait for the 
host name and port from the remote user, in this case both a psi and an 
exodus client. They send along something similar to this:

VN   5
CMD  1
ADDR 729990ed12aff38e1e4821d3b1952a8b77c2910f

and then I respond with:

VN   5
CMD  0
ADDR 729990ed12aff38e1e4821d3b1952a8b77c2910f

Then after i send this message both exodus and PSI throw up an error 
that they could not connect to a stream host. Does anyone know what I am 
doing wrong or have any insight into what i could do differently? Any 
help is greatly appreatiated.


Magnus Henoch wrote:

>Alexander Wenckus <awenckus at mindbridge.com> writes:
>>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.
>jdev mailing list
>jdev at jabber.org

More information about the JDev mailing list