Results 1 to 4 of 4

Thread: Comport or Ethernet?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    35

    Smile Comport or Ethernet?

    Dear Experts,
    I am programming a software for a hardware interfaced using either the comport or the ethernet.

    I am now specifying in my software whether the harware device has to be connected using comport or the ethernet and then i am clicking on connect button to connect to the machine. And if the software finds that the machine is not connected with the specified connection then it gives an error message.

    But what i want to do is.... When i click on Connect Machine button, then my software should automatically search for, which connection the machine is being connected and then connect using that perticular connection. How can i do this?

    Please help with this query.....

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Comport or Ethernet?

    Moved

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Comport or Ethernet?

    When you say "ethernet", what do you mean? Does the device have an IP address if it is connected that way, or is there a different protocol in use? If you have a fixed IP address, that would probably be the easiest way to start, as you would try the address, and if that doesn't work, then go for the COM ports.

    I haven't done it in years, but you can enumerate the COM ports on the system, and if you have some means to test one, as it sounds like you do, then you could iterate through all of them testing each one to see if the device is there. In my experience, programs that do this are not 100% reliable, so you would probably want some other manual means as a backup.

    If that sounds like a way to go, and nobody else posts something sooner, I can look up how I enumerated COM ports. I don't have it on this computer.
    My usual boring signature: Nothing

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Comport or Ethernet?

    this will get you each serial port name

    For Each sn As String In IO.Ports.SerialPort.GetPortNames()

    Next

    ethernet will be faster.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width