资源简介
C#建立最简单的Web服务,无需IIS

代码片段和文件信息
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace TestWeb
{
class ClientSocketThread
{
public TcpListener tcpl;//Notice: get from SrvMain.tcpl
private static Encoding ASCII = Encoding.ASCII;
public void HandleThread()
{
Thread currentThread = Thread.CurrentThread;
try
{
Socket s = tcpl.AcceptSocket();
RequestProcessor aRequestProcessor = new RequestProcessor(); //Notice:
aRequestProcessor.mSockSendData = s;//Notice: so that the processor can work
const int BUFFERSIZE = 4096;//that‘s enough???
Byte[] readclientchar = new Byte[BUFFERSIZE];
char[] sps = new Char[2] { ‘\r‘ ‘\n‘ };
string[] RequestLines = new string[32];
do
{
//use BUFFERSIZE contral the receive data size to avoid the BufferOverflow attack
int rc = s.Receive(readclientchar 0 BUFFERSIZE SocketFlags.None);
string strReceive = ASCII.GetString(readclientchar 0 rc);
RequestLines = strReceive.Split(sps);
} while (aRequestProcessor.ParseRequestAndProcess(RequestLines));
s.Close();
}
catch (SocketException)
{
}
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1348 2015-07-09 17:54 Properties\AssemblyInfo.cs
文件 2864 2015-07-09 17:54 Properties\Resources.Designer.cs
文件 5612 2015-07-09 17:54 Properties\Resources.resx
文件 1092 2015-07-09 17:54 Properties\Settings.Designer.cs
文件 249 2015-07-09 17:54 Properties\Settings.settings
文件 1517 2015-07-09 17:55 ClientSocketThread.cs
文件 1757 2015-07-09 17:56 Form1.cs
文件 2021 2015-07-09 17:56 Form1.Designer.cs
文件 5817 2015-07-09 17:56 Form1.resx
文件 488 2015-07-09 17:54 Program.cs
文件 4785 2015-07-09 17:55 RequestProcessor.cs
文件 3769 2015-07-09 17:56 TestWeb.csproj
文件 314 2015-07-09 17:58 wwwroot\index.files\colorschememapping.xm
文件 237 2015-07-09 17:58 wwwroot\index.files\filelist.xm
文件 1718 2015-07-09 17:58 wwwroot\index.files\header.htm
文件 3087 2015-07-09 17:58 wwwroot\index.files\themedata.thmx
文件 23132 2015-07-09 17:58 wwwroot\index.htm
目录 0 2015-07-09 17:58 wwwroot\index.files
目录 0 2015-07-09 17:54 Properties
..AD... 0 2015-07-09 17:58 wwwroot
----------- --------- ---------- ----- ----
59807 20
相关资源
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
- C#指纹识别系统程序 报告
- c# 高校档案信息管理系统
- c#向word文件插入图片
- C#左侧导航菜单(动态生成)
评论
共有 条评论