编写的第一个网络程序
2007-05-17 10:57
211 查看
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
namespace WindowsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string string1 =textBox1.Text;
WebRequest wrq=WebRequest .Create("http://"+string1);
WebResponse wrs = wrq.GetResponse();
Stream strm = wrs.GetResponseStream();
StreamReader sr = new StreamReader(strm);
string line;
while ((line = sr.ReadLine()) != null)
{
listBox1.Items.Add(line);
}
strm.Close();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
namespace WindowsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string string1 =textBox1.Text;
WebRequest wrq=WebRequest .Create("http://"+string1);
WebResponse wrs = wrq.GetResponse();
Stream strm = wrs.GetResponseStream();
StreamReader sr = new StreamReader(strm);
string line;
while ((line = sr.ReadLine()) != null)
{
listBox1.Items.Add(line);
}
strm.Close();
}
}
}
相关文章推荐
- 【SSH三大框架】Hibernate基础第一篇:编写第一个Hibernate程序
- 编写第一个程序HelloWorld(你好,世界)
- 利用java编写网络通信程序
- 用Free Pascal IDE编写第一个程序Pascal版的hello world
- 编写第一个Silverlight程序
- IntelliJ IDEA + Maven环境编写第一个hadoop程序
- 练习 7-6 编写一个程序,比较两个文件并打印它们第一个不相同的行
- python3编写C/S网络程序实例教程
- 《疯狂JAVA讲义》之四——编写并编译、运行第一个java程序
- delphi编写你的第一个com程序
- 手把手教您编写第一个单片机程序
- 在WINDOWS下编写小撸路由上的第一个程序
- 使用Playground编写第一个Swift程序
- [Java] 编写第一个java程序
- 编写网络程序应该注意的几个问题
- 第二章 编写第一个JAVA程序
- OpenGL入门学习——第一课 编写第一个OpenGL程序
- python+selenium 编写第一个程序 Firefox篇
- 1. 编写第一个C程序
- java网络编程学习之用java编写客户/服务器程序