EPP域名系统的数据包格式

ltsjf05 2012-07-07 02:42:20
public static void RunClient()
{

TcpClient client = new TcpClient("ote1.afilias.net", 700);

SslStream sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);

X509CertificateCollection certs = new X509CertificateCollection();
X509Certificate cert = X509Certificate.CreateFromCertFile(@"D:\my.crt");
certs.Add(cert);
try
{
sslStream.AuthenticateAsClient("myserver", certs, SslProtocols.Tls, true);
}
catch (AuthenticationException e)
{
Console.WriteLine("Exception: {0}", e.Message);
if (e.InnerException != null)
{
Console.WriteLine("Inner exception: {0}", e.InnerException.Message);
}
Console.WriteLine("Authentication failed - closing the connection.");
return ;
}

XmlDocument xmld = new XmlDocument();
xmld.Load("login.xml");//加载xml文件

string msg=xmld.InnerXml;
byte[] messsage = Encoding.Default.GetBytes(msg);

//不明白的地方,请帮忙
//EPP数据包格式要求发送的包中 首先是一个32比特的无符号整数作为长度域,表示整个包的字节长度(包括长度域本身),接下来是XML格式的内容
//这边的代码要怎么写?

sslStream.Write(messsage);
sslStream.Flush();

}
...全文
47 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧