J
jayderk
Hello All,
I seem to be having a problem with my reOpenPort function
my problem is EVERY time this function is called for the second time..
(first time I call it everything seems to go well, the second time it bombs
out).
I am just testing a loop that looks for data on the port every 10 seconds,
if it finds data great it displays the data and cycles again. If it does not
find any data for over a minute it calles this function ( I took out the
try/catch to see exactly what error was thrown).
on the second time around it failes with this error message
//
A managed CommPortException occured at Application::Run+0xf
CreateFile Failed:55
then some reference to my app and Main form
//
so, there is no communication going on. it is simply calling this function
on Minute 1 successfully and it is failing on the Minute 2 iteration every
time.
public bool reOpenPort()
{
Library.CfDebugger.WriteDebugLine("in reOpenPort");
if(port != null)
{
if(port.IsOpen)
port.Close();
Library.CfDebugger.WriteDebugLine("Closed Port");
// try
// {
if(port.Open())
{
Library.CfDebugger.WriteDebugLine("port.Open");
return true;
}
// }
// catch(Exception myex)
// {
// Library.CfDebugger.WriteDebugLine("port.Open FAILED");
// }
return false;
}
return false;
}
I seem to be having a problem with my reOpenPort function
my problem is EVERY time this function is called for the second time..
(first time I call it everything seems to go well, the second time it bombs
out).
I am just testing a loop that looks for data on the port every 10 seconds,
if it finds data great it displays the data and cycles again. If it does not
find any data for over a minute it calles this function ( I took out the
try/catch to see exactly what error was thrown).
on the second time around it failes with this error message
//
A managed CommPortException occured at Application::Run+0xf
CreateFile Failed:55
then some reference to my app and Main form
//
so, there is no communication going on. it is simply calling this function
on Minute 1 successfully and it is failing on the Minute 2 iteration every
time.
public bool reOpenPort()
{
Library.CfDebugger.WriteDebugLine("in reOpenPort");
if(port != null)
{
if(port.IsOpen)
port.Close();
Library.CfDebugger.WriteDebugLine("Closed Port");
// try
// {
if(port.Open())
{
Library.CfDebugger.WriteDebugLine("port.Open");
return true;
}
// }
// catch(Exception myex)
// {
// Library.CfDebugger.WriteDebugLine("port.Open FAILED");
// }
return false;
}
return false;
}