File segmentation

xiaoxiao2021-03-06  42

I want to cut a file into a small piece of packet, send it. The following is the code: long ll_count; Byte [] buff = new byte [1000]; long nread; int L_pos = 0; ll_count = LFilelen / 1000; for (int i = 1; i <= ll_count; i ) {nread = filefs .Read (BUFF, LL_POS, 1000); Senddata (BUF); LL_POS = LL_POS 1000; Filefs.close (); First 1000 bytes, the second time I have reported: Unprocessed " System.Argumentexception "The exception appears in Mscorlib.dll. Additional information: Offset and length have exceeded the array boundary, or the count is greater than the number of elements at the end of the source collection. How did I write correct? Correct way: FILESTREAM FSIN = New FileStream (FileName, FileMode.Open, FileAccess.Read);

String basepath = system.io.path.getdirectoryName (filename);

INT filesize = (int) fsin.Length; int segments = (int); int Remainder = (int));

IF (Remainder> 0) Segments ;

Byte [] buffer = new byte [m_blocksize];

INT BYTESREAD = 0; try {for (INT i = 0; i

For (int J = 0; j

转载请注明原文地址:https://www.9cbs.com/read-75084.html

New Post(0)