ååï¼id:seiunsky:20061101:1162404086ï¼
å®ã¯ãååã®ããã°ã©ã ã§ã¯ãã¼ã¿ã®åä¿¡ããã¾ãè¡ã£ã¦ããªãã£ãã
ã¹ã¬ãã対çããããã¨ã§ä½æ
ãåé¡ã解決ããã®ã§ãã¾ããããã¨æã£ã¦ããã®ã ããBackGroundWorkerã使ãããã«ãã¦ããåçºãã¦ãã¾ã£ãï¼id:seiunsky:20061122:1164233420ï¼ã
ã§ãæåã¯ã¹ã¬ããã«ãã¦ããã®ãåé¡ãªã®ãã¨æã£ã¦ãããã©ãã¹ãããå®è¡æãã³ã³ã½ã¼ã«ã«å¤ãåºåãããããªããã°ã©ã ã«ãã¦åããã¨ãã¡ãã¨ãã¼ã¿ãåãã¦ããã
ã©ãããNetworkStream.DataAvailableãã¾ããããã ã
ã¨ããã®ãããããã°æ
å ±ãã³ã³ã½ã¼ã«ã«åºåãããããã¨ãç»é¢æç»ã®ããã«å®è¡é度ãé
ããªãããã®ãããªã¦ã§ã¤ããããã£ã¦ããã¨ãã¯å¤§æµãã¼ã¿ããã¡ãã¨åãã¦ãã¦ãã¦ã§ã¤ããããããªãç¶æ
ã ã¨DataAvailableã®ç¶æ
ããã¡ãã¨åããªãããã ã
ã§ãå½åDataAvailableãtrueã®æãæ¡ä»¶ã¨ãã¦whileæãæ¸ãã¦ãããããç¶æ³ã«ãã£ã¦å
¨ç¶å¤ãåããªããã¨ãããã¨ã«ãªã£ã¦ããããã ã
DataAvalibleãæªããã¨ç¨ãã§èª¿ã¹ã¦ã¿ããâã®ãããªè¨è¿°ããã£ããFTPãPOP3ã§ã¯ç¡ããã®ã®ãã¾ãã«ãã®çç¶ã ã
FTPã§ãã¦ã³ãã¼ããããã¡ã¤ã«ã®ãã¤ãæ°ãç¥ãæ¹æ³ - Insider.NET
http://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=2658&forum=7
ã¡ãã£ã¨ããã辺ãåèã«ãã¦è§£æ±ºçã調ã¹ã¦ã¿ãããã¨ããããæ¥æ¬èªã®æ
å ±ãå
¨ç¶ãã¼ãã ãã©ã
ã¡ãªã¿ã«ã以ä¸ã¯æ¤è¨¼ã®ããã«è¶
ææãã§ãããã¯ã¼ã¯ã¸ã¢ã¯ã»ã¹ããããã°ã©ã ãå¤æ°åã«çµ±ä¸æããªãã¨ã宣è¨ã®å ´æãæ°ã«é£ããªãã¨ãããã ãããã©ãåé¡ãåãåããããã ãã«æ¸ããã®ã§ããã¾ã§çªã£è¾¼ã¾ãªãã§æ¬²ããã
使ãæ¹ã¯ä»¥ä¸ã®ã¯ã©ã¹ãçæãã¦connectã¡ã½ããããã°è¯ããããã¯ãã®ã¡ã½ããã使ã£ã¦æ®éã«å®è¡ããã¨ä½ã®æååãå¾ããã¨ãåºæ¥ãªãã£ãããã
using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Net.Sockets; namespace telnetConsole { class telnet { private string URL = "www.yahoo.co.jp"; private string Address = ""; private int port = 80; private IPAddress[] ip; private TcpClient client; private NetworkStream ns; public string connect() { ip = Dns.GetHostAddresses(URL); Address = ip[0].ToString(); client = new TcpClient(); client.Connect(Address, port); ns = client.GetStream(); byte[] buff = System.Text.Encoding.ASCII.GetBytes("GET /index.html \r\n\r\n"); ns.Write(buff, 0, buff.Length); ns.Flush(); byte[] getByte; StringBuilder sb = new StringBuilder(); while (ns.DataAvailable) { getByte = new byte[client.ReceiveBufferSize]; int size = ns.Read(getByte, 0, getByte.Length); sb.Append(System.Text.Encoding.ASCII.GetString(getByte)); } return sb.ToString(); } } }