title: System.IO.Ports.SerialPort - can IOCTL_SERIAL_SET_WAIT_MASK be configured?
body: <p>I've been trying to learn a bit about how .Net (3.5) interacts with the Serial port through the <code>System.IO.Ports.SerialPorts</code> class by writing a small Windows Forms application to gather caller display data from an old external modem.</p>
  
  <p>I've tested that the modem supports caller display; using Putty or Hyperterminal I can configure the modem to collect caller display data (using the command <code>AT#CID=1</code>, which I found <a href="http://ftp.mtnsys.com/Pages/howto/htmdmtst.htm" rel="nofollow noreferrer">here</a>), and when the phone rings, the data is displayed. In the terminal window, it looks like this:</p>
  
  <pre><code>RING
  
  DATE = 0308
  TIME = 2045
  NMBR = 01234567890
  
  RING
  </code></pre>
  
  <p>My C# application appears to successfully configure the modem and displays a <code>RING</code>
  message when the phone rings; however, it never displays the caller ID data.</p>
  
  <p>In an effort to understand why this is, I compared the actions taken by the different clients using Sysinternals <a href="http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx" rel="nofollow noreferrer">Portmon</a>.</p>
  
  <p>The primary difference appears in the connection configuration; my C# application includes the following line, which Putty and Hyperterminal do not;</p>
  
  <pre><code>0.00000307  callerID.exe    IOCTL_SERIAL_SET_WAIT_MASK  Serial0 SUCCESS Mask: RXCHAR RXFLAG CTS DSR RLSD BRK ERR RING   
  </code></pre>
  
  <p>As I understand it, <code>IOCTL_SERIAL_SET_WAIT_MASK</code> is an inclusive list of message types to filter for. </p>
  
  <p>So, three questions:</p>
  
  <p>Is it possible that the caller ID information is being suppressed by <code>IOCTL_SERIAL_SET_WAIT_MASK</code>? </p>
  
  <p>If so, how can I configure it to show the caller ID info? It doesn't appear to be accessible from the class properties.</p>
  
  <p>If I can't configure it, is my only option to get around this to write my own wrapper to the lower-level system functions controlling the serial port?</p>
  
  <p>My understanding of serial port communications is very basic, so I expect I'm way off in my diagnosis. Any guidance gratefully received.</p>