基于TCPUDP使用C_開发的简易qq.docVIP

  • 2
  • 0
  • 约2.62万字
  • 约 21页
  • 2016-11-27 发布于重庆
  • 举报
基于TCPUDP使用C_開发的简易qq

TCP/UDP程序开发 使用C#制作简易qq TCP、UDP程序开发 实验课时 8学时 实验目的 开发TCP/UDP协议应用程序,掌握网络应用程序的工作原理。通过本实验,深入理解TCP和UDP协议的异同点,了解网络协议的工作过程,学会网络通信编程的基本方法,能够编制网络应用程序。 实验内容 了解和掌握“基于UDP——面向无连接的应用程序”和“基于TCP——面向连接的应用程序”的运行机制和编程方法。 选择以下一个内容,编写一个网络通信应用程序 聊天程序; 邮件收发程序; HTTP服务器程序。 实验要求 使用任意编程语言(如Java,C,VB,Delphi等)编写基于TCP或UDP协议的网络应用程序。 总结实验过程,内容包括:方案、程序、调试、结果、分析、结论。 实验设备 硬件要求:计算机、Internet网。 软件要求:Windows操作系统、相关软件开发工具(如Microsoft Visual Studio,JDK等)。 预习要求 复习TCP/UDP协议原理。 复习应用进程跨越网络通信的基本编程方法。 复习聊天、邮件、HTTP服务的相关原理。 熟悉相关编程语言及编程工具环境。 注意事项 遵守实验纪律,爱护实验设备。 提交详细实验报告一份。实验过程和结果不能简单地复制相关命令或内容,要有理解和分析。 程序代码 1.服务器端 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.Net.Sockets; using System.Threading; using System.IO; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); this.Init(); tab2.Visible = true; tab3.Visible = false; tab1.Visible = false; } private void btnLog_Click(object sender, EventArgs e) { if (txtIP.Text == || txtPort.Text == ) { MessageBox.Show(请输入IP地址或端口号!, 提示信息, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } else { try { IPAddress ipadd = IPAddress.Parse(this.txtIP.Text); int port = Convert.ToInt32(this.txtPort.Text); tab3.Visible = true; tab1.Visible = true; this.Init2(); this.btnImgFile.Enabled = false; this.Text = 服务器 + DateTime.Now.ToString() + + DateTime.Now.DayOfWeek.ToString(); richTextBox1.AppendText(System:服务器已进入聊天室!?- + DateTime.Now.ToLongT

文档评论(0)

1亿VIP精品文档

相关文档