Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //SOCKS5 Proxy Example
- _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- _socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
- IPEndPoint localEndPoint = null;
- localEndPoint = new IPEndPoint(IPAddress.Loopback, _config.localPort);
- _socket.Bind(localEndPoint);
- _socket.Listen(1024);
- _socket.BeginAccept(
- new AsyncCallback(AcceptCallback),
- _socket);
- //Socket Connect Example
- Public Socket localClient = null;
- IPEndPoint remote = new IPEndPoint(ipAddress, 3030);
- localClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- localClient.Connect(remote);
- IPAddress localIP = IPAddress.Parse(((IPEndPoint)localClient.RemoteEndPoint).Address.ToString());
- Console.WriteLine(localIP);
- clients.Add(localClient);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement