views:

1151

answers:

4

I have two Conexant fax modems, and a C# app with two serialPort objects setup to listen for incoming data on both comm ports.

Here is how I initialize each modem:

m_SerialPort = new SerialPort("COM3", 2400);
m_SerialPort.DataReceived += new SerialDataReceivedEventHandler(this.ReceiveChars);

try
{
    m_SerialPort.Open();
    m_SerialPort.DiscardInBuffer();
    m_SerialPort.DiscardOutBuffer();    
}
catch (Exception e)
{
    // die gracefully
}
finally
{
    m_SerialPort.DtrEnable = true;
}

And the second modem is initialized to a different SerialPort object but with "COM4".

Whatever COM port I initialize first can receive data, but the second COM port will not receive data.

Is this a problem with my initialization, C#'s SerialPort class, or Windows XP refusing to let two modems operate at the same time?

Any advice or suggestions are welcome.

UPDATE

Have you checked under "Device Manager" that both ports are configured, enabled and working?

Yes, they are both there with seperate ports.

Have you tried something like Hyperterm to try and send data to the ports?

Tried opening both comm ports in separate hyper terminals, and failed to open the second comm port.

+1  A: 

Have you checked under "Device Manager" that both ports are configured, enabled and working?

Have you tried something like SysInternals PortMon to monitor the ports?

Have you tried something like Hyperterm to try and send data to the ports?

nzpcmad
A: 

I'm going to guess (what else can I do?) that you're doing something naughty in your ReceiveChars method (perhaps you're updating the GUI, without using Invoke), and that this is preventing the ReceiveChars method from being called again.

ChrisW
+1  A: 

Looks like the issue is simply that two Conexant modems cannot operate on the same PC at the same time. I put in another modem from another vendor, and I was able to open both com ports.

Justin Tanner
Probably a driver issue, since the modem is software driven. Generally, when available hardware (serial) modems are your best bet for consistency and stability. Though few newer motherboards come with more than one, if any serial port.
Tracker1
+1  A: 

Tip: Use this tool to test your application, it creates virtual com ports.
http://sourceforge.net/projects/com0com/

lsalamon