我m create a coturn server and check it by TrickleICE https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ . Its work. Now i want to write simple client. I
通过 UDP 客户端连接到服务器:
udpClient = new UdpClient();
IPAddress ipAddress = IPAddress.Parse(IpAddress);
ipEndPoint = new IPEndPoint(ipAddress, Port);
try
{
udpClient.Connect(ipEndPoint);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
然后我像这里描述的那样创建标题和属性字节数组:https ://datatracker.ietf.org/doc/html/rfc5766
创建标头示例:
byte[] header = new byte[20];
byte[] messageT = BitConverter.GetBytes((Int16)messageType);
byte[] messageLength;
messageLength = BitConverter.GetBytes((Int16)attributeLength);
byte[] TransactionId = MyTransactionByteArray
messageT.CopyTo(header, 0);
messageLength.CopyTo(header, 2);
TransactionId.CopyTo(header, 4);
当我通过 stun 协议(https://datatracker.ietf.org/doc/html/rfc3489#section-11.1)发送没有任何属性的标头时,服务器日志显示:
handle_udp_packet: New UDP endpoint: local addr 0.0.0.0:10000, remote addr "myip":"port"
Wrong OLD STUN message received
使用属性(如这里:https ://datatracker.ietf.org/doc/html/rfc5766#section-16 ):
handle_udp_packet: New UDP endpoint: local addr 0.0.0.0:10000, remote
addr "myip":"port"
我没有得到任何回应。
IPEndPoint ip = null;
byte []msg = udpClient.Receive(ref ip);
我哪里做错了?