fork download
  1. try
  2. {
  3.  
  4. //ホスト名からIPアドレスを取得
  5. IPAddress hostadd = Dns.GetHostEntry(inf.comsrvaddr).AddressList[0];
  6. //IPEndPointを取得
  7. IPEndPoint ephost = new IPEndPoint(hostadd, int.Parse(inf.comsrvport));
  8. //Socketの作成
  9. System.Net.Sockets.Socket sock = new System.Net.Sockets.Socket(
  10. System.Net.Sockets.AddressFamily.InterNetwork,
  11. System.Net.Sockets.SocketType.Stream,
  12. System.Net.Sockets.ProtocolType.Tcp);
  13.  
  14. //接続
  15. sock.Connect(ephost);
  16.  
  17. //コメントリクエストメッセージを送信
  18. string param = String.Format(
  19. "<thread thread=\"{0}\" version=\"20061206\" res_from=\"-1\"/>\0", inf.comsrvthreID);
  20. byte[] data = Encoding.UTF8.GetBytes(param);
  21. sock.Send(data, data.Length, System.Net.Sockets.SocketFlags.None);
  22.           pre = "";
  23. const int MAX_RECEIVE_SIZE = 1048576*64;
  24. byte[] resbytes = new byte[MAX_RECEIVE_SIZE];
  25. int ressize = 0;
  26. while (MainForm.flgthrecancel == false)
  27. {
  28. //受信
  29. ressize = sock.Receive(resbytes, resbytes.Length, System.Net.Sockets.SocketFlags.None);
  30. if (ressize == 0) continue;
  31. string xml = pre + Encoding.UTF8.GetString(resbytes, 0, ressize);
  32.             /*途切れた場合に、受信に近い所で早く次の受信に繋げようとしたが駄目だったため、
  33.              *コメントアウト
  34.   if (!xml.EndsWith("/chat>\0") && !xml.EndsWith("/>\0"))
  35.   {
  36.   pre = xml;
  37.   continue;
  38.   }
  39.   pre = "";
  40.   */
  41. xml = xml.Replace('\0', '\n');
  42. string[] lines = xml.Split('\n');
  43. foreach (string line in lines)
  44. {
  45.  
  46. if (line != ""&&!line.EndsWith("/chat>"))
  47. {
  48.                 //MAX_RECEIVE_SIZEいっぱいに受信した場合等
  49. //XMLが閉じていない場合は次回Receive時結合する
  50. pre = line;
  51. break;
  52. }
  53.  
  54. if (line.StartsWith("<chat "))
  55. {
  56. //コメント取得
  57. //<chat>ここ</chat>を取り出す
  58.  
  59. XmlDocument xdoc = new XmlDocument();
  60. xdoc.LoadXml(line);//**************ここでエラーが起きる
  61. XmlElement root = xdoc.DocumentElement;
  62. Come come = new Come();//コメント情報収納用インスタンス
  63. string comeno="" ,comecmd="",comememstatus = "";
  64. foreach (XmlAttribute attrib in root.Attributes)
  65. {
  66.  
  67. if (attrib.Name == "no")
  68. {
  69. come.No = "No." + attrib.Value;
  70. }
  71. if (attrib.Name == "mail")
  72. {
  73. come.Command= attrib.Value ;
  74. }
  75. if (attrib.Name == "premium")
  76. {
  77. switch (attrib.Value)
  78. {
  79. case "0": comememstatus = "一般"; break;
  80. case "1": comememstatus = "プレ"; break;
  81. case "2": comememstatus = "アラ"; break;
  82. case "3": comememstatus = "主"; break;
  83. case "6": comememstatus = "運営"; break;
  84. case "7": comememstatus = "BSP"; break;
  85. case "8":
  86. case "9": comememstatus = "iPhone"; break;
  87. default: comememstatus = "不明" + attrib.Value; break;
  88. }
  89. come.Status = comememstatus;
  90.                       inf.deleary(come);//delegateでcomeオブジェクトを渡す
  91. }
  92. }
  93. come.Coment = xdoc.InnerText.ToString();
  94. }
  95. }
  96. cometext = ""; debug = "";
  97. }
  98. info = "コメント取得スレッドを停止しました。";
  99. MessageBox.Show(null,"コメント取得を停止しました","",MessageBoxButtons.OK,MessageBoxIcon.None);
  100. }
  101. catch (Exception e)
  102. {
  103. info += "\r\n投稿失敗!\r\n";
  104. info += "Message :n" + e.Message + "\r\n";
  105. info += "Type :n" + e.GetType().FullName + "\r\n";
  106. info += "StackTrace :n" + e.StackTrace.ToString() + "\r\n";
  107. info += "エラーライン:" + debug;
  108. inf.deleinfo(info);
  109. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,4): error CS8025: Parsing error
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty