我想在我的C#应用程序中添加一个代理层,该代理层连接到ip地址。我有我的代理服务器地址和端口,但是我不知道如何将其与UdpClient请求一起使用。这是代码,感谢您的帮助。
WebProxy myproxy = new WebProxy("IP Address", Port);
UdpClient client = new UdpClient();
string ipaddr = IPText.Text;
try
{
client.Connect(ipaddr, 80);
byte[] sendBytes = Encoding.ASCII.GetBytes(DataText.Text);
client.Send(sendBytes, sendBytes.Length);
client.AllowNatTraversal(true);
client.DontFragment = true;
}