你们能告诉我为什么我无法接收数据吗?
我使用了来自http://www.bittorrent.org/beps/bep_0015.html的 UDP Tracker 协议
这是我尝试从 udp://tracker.openbittorrent.com:80/announce 获取信息时的代码
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
client.Connect("tracker.openbittorrent.com", 80);
byte[] conPacket = new byte[16];
byte[] temp = BitConverter.GetBytes(0x41727101980);
byte[] temp2 = BitConverter.GetBytes(0);
byte[] temp3 = BitConverter.GetBytes(new Random().Next(0, 65535));
Array.Copy(temp, 0, conPacket, 0, 8);
Array.Copy(temp2, 0, conPacket, 8, 4);
Array.Copy(temp3, 0, conPacket, 12, 4);
client.Send(conPacket);
byte[] recvPacket = new byte[16];
client.Receive(recvPacket); <--------------- Waiting for response
client.Close();