请求唤醒服务器(Coturn)



Im 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. Im通过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());
}

然后创建header和attribyte字节数组,如下所示: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);

我哪里做错了?

好的。只要使用这个头从最新的stun协议:https://datatracker.ietf.org/doc/html/rfc5389

相关内容

  • 没有找到相关文章

最新更新