How do I find out if the proxy speaks Socks v4 or v5?
Im trying to make a program that connects to a proxy but i have a little problem, I have socksv4 and v5 protocal written up but how do i know which version the proxy is?
The reason I'm not using the standard java proxy object is because I want to use socket channels and I basically have to do it manually.
Irrelevant code:
String getIP = jTextField1.getText();
String[] splitIP = getIP.split("\\.");
byte[] wbytes = new byte[9];
wbytes[0] = (byte) 0x04;
wbytes[1] = (byte) 0x01;
byte one = (byte) Integer.parseInt(splitIP[0]);
byte two = (byte) Integer.parseInt(splitIP[1]);
byte three = (byte) Integer.parseInt(splitIP[2]);
byte four = (byte) Integer.parseInt(splitIP[3]);
checkC = new int[liveCon.length];
int pSlot = liveCon.length;
int[] standBy = new int[liv开发者_开发百科eCon.length];
I think the usual way would be to try to connect with v5, and if the server refuses, retry with v4.
(The first byte of the first message sent by the client is the version number.)
精彩评论