Hi all!i have a read function here.I face a problem,it just can read limited byte only..Can somebody help me?Where to edit to make it read more byte?Thank so much!public byte[] Read(int NumBytes) { byte[] BufBytes; //------Declaring of dynamic Array byte[] OutBytes; //------Declaring of dynamic Array BufBytes = new byte[NumBytes]; //------Setting the Array Size to NumBytes( From parameter ) /*-- Check Port is Open --*/ if( hComm != INVALID_HANDLE_VALUE ) { OVERLAPPED ovlCommPort = new OVERLAPPED(); //------Declaring of ovlCommport int BytesRead = 0; //------Declaring of BytesRead and set to 0
ReadFile(hComm, BufBytes, NumBytes, ref BytesRead, ref ovlCommPort); //------Get data from RS232 OutBytes = new byte[BytesRead];//------Setting the size of Array to BytesRead Array.Copy(BufBytes, OutBytes, BytesRead); //------Copy previous array data to new array data for preventing data loss
return OutBytes; //------Return the GET data }/*-- End of Check Port is Open --*/
return null; //------Return null( nothing )}/*-- End of Function Read --*/