NewLinkClass.cs
上传用户:zhangkuixh
上传日期:2013-09-30
资源大小:5473k
文件大小:2k
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Net;
- using System.Net.Sockets;
- using System.Text;
- using System.IO;
- /*
- ' 迅龙中文分类搜索引擎 v0.6
- '
- ' LGPL 许可发行
- '
- ' 宁夏大学 张冬 康彩 zd4004@163.com
- '
- ' 官网 http://blog.163.com/zd4004/
- */
- namespace XunLong.NewXWord
- {
- class NewLinkClass
- {
- Encoding gbx = System.Text.Encoding.GetEncoding("gb2312");
- Socket clientSocket;
- string Set_Path;
- public NewLinkClass(Socket socket)
- {
- this.clientSocket = socket;
- }
- public void Run()
- {
- Byte[] read = new byte[2048];
- try
- {
- while (true)
- {
- //存放解析出地址请求信息
- int bytes = clientSocket.Receive(read, 2048, 0);
- if (bytes == 0)
- {
- clientSocket.Close();
- return;
- }
-
- string str = gbx.GetString(read, 0, bytes);
- string bk = ClassCMD.GetOne(str);
- byte[] message =gbx.GetBytes(bk);
- clientSocket.Send(message);
- }
- }
- catch
- {
- try
- { clientSocket.Close(); }
- catch
- { }
- }
- }
- }
- }
-