110,532
社区成员
发帖
与我相关
我的任务
分享
public static List<int> GetHttp (string httpUrl)
{
List<int> result = new List<int>();
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create (httpUrl);
myReq.Method = "GET";
try
{
HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse ();
System.IO.Stream myStream = HttpWResp.GetResponseStream ();
int data = -1;
while ((data = myStream.ReadByte()) != -1)
{
// 因为不清楚 myStream.Length 是否真实字节流长度. 所以用了动态数组List
result.Add(data);
}
}
catch (Exception exp)
{
Debug.Log(exp.ToString());
}
return result ;
}