SOCKS5 User Authentication and IP Bind problem!


My project working (without user authentication and with lan default ip)

[url removed, login to view] bind problem. i've several ip addresses. All of the incoming connections was bind to default ip. how can do bind any ip without default ip?

[url removed, login to view] i have used SOCKS_AUTH project confused.

any body help me? thanks

here is part of my code.

NetworkStream socksClientStream = [url removed, login to view]();


* supported methods part


byte[] authFields = new byte[2];

[url removed, login to view](authFields, 0, 2);

// read n supported methods

byte[] methods = new byte[authFields[1]];

[url removed, login to view](methods, 0, [url removed, login to view]);


* method selection part


byte[] selectedAuthMethod = { SOCKS_VERSION, SOCKS_NOAUTH };

[url removed, login to view](selectedAuthMethod, 0, 2);

// return version and auth method "no auth"

byte[] requestFields = new byte[4];

[url removed, login to view](requestFields, 0, 4);

// adresstypes ipv4 and hostname are supported

string connection_target = "";

int target_port;

if (requestFields[3] == SOCKS_IPV4ADDR )


//ip4v adress is requested

byte[] target_data = new byte[4];

[url removed, login to view](target_data, 0, 4);

IPAddress ip = new IPAddress(target_data);

connection_target = [url removed, login to view]();


else if (requestFields[3] == SOCKS_DNSNAME )


byte[] domainname_length = new byte[1];

[url removed, login to view](domainname_length, 0, 1);

byte[] target_data = new byte[domainname_length[0]];

[url removed, login to view](target_data, 0, domainname_length[0]);

connection_target = [url removed, login to view](target_data);




//unsupported addresstype


//if requested address is supported

if (connection_target != "")



* server client connection part


//doc: byteorder

byte[] bintargetport = new byte[2];

[url removed, login to view](bintargetport, 0, 2);

byte[] tmp_byteorder = new byte[2];

tmp_byteorder[0] = bintargetport[1];

tmp_byteorder[1] = bintargetport[0];

target_port = (int)[url removed, login to view](tmp_byteorder, 0);

serverClient = new TcpClient(connection_target, target_port);

/* **

* reply part


if ([url removed, login to view])


// reply successful audience

byte[] reply = new byte[10];


reply[0] = SOCKS_VERSION ;

// replycode


//reserved and 0

reply[2] = 0;

// addresstype

reply[3] = 1;

string ip = [url removed, login to view]().Split(':')[0];

IPAddress ipaddr = [url removed, login to view](ip);

reply[4] = [url removed, login to view]()[0];

reply[5] = [url removed, login to view]()[1];

reply[6] = [url removed, login to view]()[2];

reply[7] = [url removed, login to view]()[3];

int port = [url removed, login to view]([url removed, login to view]().Split(':')[1]);

reply[8] = [url removed, login to view]((UInt16)port)[0];

reply[9] = [url removed, login to view]((UInt16)port)[1];

[url removed, login to view](reply, 0, 10);


* tcp redirection


NetworkStream serverClientStream = [url removed, login to view]();

bool ioError = false;

while ([url removed, login to view] && [url removed, login to view] && !ioError )




Skills: C# Programming

See more: the string problem, string problem, selection problem, part problem, parse programming, no problem part 1, else if c programming, TCP iP, tcp / ip, ipv4, ip tcp, bind, server requested authentication, socks5 code, tcp redirection, tcp help, client server encoding, unsupported, tcp connections, tcp connection programming, server socks5, bind server, body socks, working project user authentication, socks5 client

Project ID: #4551014

Awarded to:


Please check my PM, I can do it

$30 USD in 1 day
(1 Review)

3 freelancers are bidding on average $41 for this job


I have over 10 years experience in .NET & ready to start working.

$34 USD in 3 days
(2 Reviews)

We provide you industry standard Mobile Apps, Software, Desktop Apps, Web Stores, Websites and Web Apps. So, you get all at one place! We can provide you the following: - iOS applications - Android applications More

$33 USD in 3 days
(1 Review)

i can do it

$60 USD in 3 days
(0 Reviews)