c# - Does Write send all bytes? (Serial Port) -


does write method of serialport write bytes told to? have code send data via serial port.

            serialport port = new serialport(               "com1", 9600, parity.none, 8, stopbits.one);              // open port communications             port.open();              // write bytes             byte[] bytes = encoding.ascii.getbytes("hello world pc");             port.write(bytes, 0, bytes.length);              // close port             port.close(); 

if send string "hello" device connected pc via serial port receives well. if send string "hello world pc" receives first 16 bytes instead of 19. there way can verify in code bytes sent? or problem of hardware connected via serial port?

yes, .write synchronous data send before returns. anyway, 30 second timeout more enough, event if wouldn't.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -