Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

COM Port Busy

Only one program at a time (Windows or DOS) can use a particular COM port. From DOS, a COM port always appears available, even though it may not work.

Is there a way from DOS (a DOS box underneath Windows) to determine if a particular COM port is already busy?


Comments

  • I haven't messed with com ports in a while, but if I remember correctly, you could try something similar to the way I now check to see if a program can open a file:

    if((infile = fopen("x.xxx", "w+b")) == NULL)
    {
    //Code saying stuff is in use or can't be opened
    }

    That's how I check for opening files, but I used to do something similar when I programmed in DOS. If I can find some of my code I'll post it for you.

    -Seph


  • : I haven't messed with com ports in a while, but if I remember correctly, you could try something similar to the way I now check to see if a program can open a file:
    :
    : if((infile = fopen("x.xxx", "w+b")) == NULL)
    : {
    : //Code saying stuff is in use or can't be opened
    : }
    :
    : That's how I check for opening files, but I used to do something similar when I programmed in DOS. If I can find some of my code I'll post it for you.
    :
    : -Seph
    :

    My program is looking directly at the UART. Even when a Windows program (or a DOS program in a different DOS Box) has control of the modem, the UART shows the Serial port as "normal", even though it's actually busy and can't be used. I can't imagine a DOS "is the COM port already open" function will detect anything different.

    I could be wrong, but I think I'm actually going to need an appropriate Windows API function that can be called from a DOS box. There are a limited number of such functions available, but I can't find documentation on anything having to do with Serial ports. I was hoping somebody else might know something.

    --Bret


  • I have never done it, by maybe write-read-check_if_the_same some of read/write accesible UART registers will show, if windows are blocking acces to them or not. Its just the suggestion.


  • : I have never done it, by maybe write-read-check_if_the_same some of read/write accesible UART registers will show, if windows are blocking acces to them or not. Its just the suggestion.
    :

    I've thought of that, too. The UART "acts normal" in every way, and even responds appropriately if you change any of its settings. But, it never dials, and it never sends or receives any data, even though it acts like it should be.


Sign In or Register to comment.