[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1594
  • Last Modified:

Reseting the com port when 8005 error

Hi, I am using the MSComm control and I receiving a 8005 error as if the port is open.  The situation is that I am trying to close the port just before trying to open it and then I received the 8012 as if the port is already close. If I comment the close script and run the code again it said that the port is open.  How the port is open if when I try to close it, it said is close?  If there a way to force close the port before try to open it?
It does not make sence that the port is open and also close at the same time.  I am not an expert programmer but...

Thanks.
0
waldemar_tavarez
Asked:
waldemar_tavarez
2 Solutions
 
ChiefITCommented:
http://www.sharewareconnection.com/port-mapper.htm

Port Mapper is a freeware tool which helps home users open/close ports in their routers and gateways securely. It automatically maps and manages ports in the router, enabling online multiplayer game play without disturbing the gaming session. Port Mapper is more secure than manually opening and closing ports, because it opens the ports only when needed and automatically closes them when you are finished playing. Port Mapper works with your Internet gateway/router in such a way that you can have control on the programs that communicate over your network. Using Port Mapper, you can expose applications to your friends over the internet in a safe manner
0
 
RobSampsonCommented:
Without seeing your code, I could only find VB6 code, but it uses this
'=============
    frmMain.MSComm1.CommPort = Count
    frmMain.MSComm1.PortOpen = True
    If Err.Number = 8005 Then
        'The port is already open
        'The port exists, so add it to the list.
        NumberOfPorts = NumberOfPorts + 1
        CommPorts(NumberOfPorts) = "COM" & CStr(Count)
    ElseIf frmMain.MSComm1.PortOpen = True Then
        'If the port opens, it exists.
        'Close it and add to the list.
        frmMain.MSComm1.PortOpen = False
        NumberOfPorts = NumberOfPorts + 1
        CommPorts(NumberOfPorts) = "COM" & CStr(Count)
    Err.Clear
    End If
'=============

Regards,

Rob.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now