code_junkie

Two Modems, two SerialPort objects in C#

Nov 13th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. m_SerialPort = new SerialPort("COM3", 2400);
  2. m_SerialPort.DataReceived += new SerialDataReceivedEventHandler(this.ReceiveChars);
  3.  
  4. try
  5. {
  6. m_SerialPort.Open();
  7. m_SerialPort.DiscardInBuffer();
  8. m_SerialPort.DiscardOutBuffer();
  9. }
  10. catch (Exception e)
  11. {
  12. // die gracefully
  13. }
  14. finally
  15. {
  16. m_SerialPort.DtrEnable = true;
  17. }
Add Comment
Please, Sign In to add comment