Using MSCOMM in VB to connect to remote PLC


Thread Starter


Here's the scoop- I have a PLC (KOYO) at a remote location where I have installed a modem that uses RS-232 to talk to the PLC. I then have
a computer at the office with a modem that I want to dial to the remote site, then allow me to control the PLC. I have no problem with
coding MSCOMM to dial the site, or how to talk to the PLC. What I am having problems with is MSCOMM "handing" off the serial port after it
has connected. Iv'e read numerous articles on here which talked about port sharing, but I cant seem to get that to work. Iv'e tried
disabling DTR on the modem so that it will stay connected after I give a "mscomm1.portopen = false", but that doesn't work either. Could
someone please help me out with either some source code in vb to do this, or a way that this could be done? I would really appreciate the
help.. Thanks guys..

I don't think that you can use a serial port with more than one device at a time. I'm also pretty sure that the dial-up modem is constructed so that it hangs up when you disconnect from it (portopen = false).

Anyway... you would probably get a better answer if you asked these questions on some newsgroups like comp.programming, comp.lang.basic.visual or similiar.
You have to use +++ then ATH (As AT HangUp) then you can close the port!!!

Is there anyone how know how to use winAPI32 Readfile???