当前位置:编程学习 > C#/ASP.NET >>

C# socket 多线程多管道可断点传送大文件(附单线程单管道传送)

有啥BUG,问题请发送email至ilovehaley.kid@gmail.com ,谢谢。:D

 

\代码
1 #define Sleep
2  //#undef Sleep
3 //#define TransmitLog
4 #undef TransmitLog
5 //#define BreakpointLog
6 #undef BreakpointLog
7 using System;
8 using System.Net;
9 using System.Net.Sockets;
10 using System.IO;
11 using System.Text;
12 using System.Threading;
13 using System.Collections.Generic;
14 using System.Diagnostics;
15
16 namespace Rocky
17 {
18 public static class FileTransmiter
19 {
20 #region NestedType
21 private class SendWorker : IWorker
22 {
23 private long totalSent, totalSend;
24 private byte[] buffer;
25 private Socket sock;
26 private FileStream reader;
27 private Thread thread;
28 private bool isFinished;
29
30 public long TotalSent
31 {
32 get { return totalSent; }
33 }
34 public long TotalSend
35 {
36 get { return totalSend; }
37 }
38 public byte[] Buffer
39 {
40 get { return buffer; }
补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,