• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

connect to another com-port through modem

I am writing a software to read the output of a com port of an instrument. The instrument, continuously send its status condition thro its com port. I have developed a program to read the com port data from a pc.
Now, I want to read this com port from a remote pc, using modem. I wrote MSCOMM1.OUTPUT = ATDT & phone number & vbcr
My phone dials the modem which is connected to the com port of the instrument.(Both externam com ports) It connects and the connecting sound stops. But I don't get any meaningful data. Is it necessary for me to implement any modem protocol? Or do I need some soecial modems?

Please help
0
shivajivarma
Asked:
shivajivarma
  • 6
  • 5
1 Solution
 
bill02Commented:
are you using 2 phone lines? if not there is a special modem i can't rember the name of the setting but the courrier v everything modem had this setting it allowed you to connect 2 modems together without needing a dial tone.
0
 
inthedarkCommented:
From your question I understand the following:

You have a device on COM PORT X
You have a modem on COM PORT Y

Yoy want to pipe the output from comport x down the phone line via com port y

So first you have to make you phone answer a call:


' to set waiting
MSCOM1.Output "ATZ"+vbcrlf ' Reset modem
MSCOM1.Output "ATV1"+vbcrlf ' select verbose modem responses
MSCOM1.Output "ATS0=1"+vbcrlf ' answer after one ring


Buffer=""
Do
  Buffer=Buffer+mscom1.input
   
  ' the actual connection message will vary
  ' dependent on the modem
  if instr(Buffer,"CONNECTED")>0 Then exit do
  Sleep 5000
loop

you are now on line and can pipe the data between x/y


0
 
inthedarkCommented:
You can set the outward dialing as follows:

' to set waiting
MSCOM1.Output "ATZ"+vbcrlf ' Reset modem
MSCOM1.Output "ATV1"+vbcrlf ' select verbose modem responses
MSCOM1.Output "ATD T1234565"+vbcrlf ' Dial


' Now you can loop until connected

Dim Starter as Date
Dim TimeOut as single
TimeOut=60 ' seconds
Starter=now
Buffer=""
Do
 Buffer=Buffer+mscom1.input
   
 ' the actual connection message will vary
 ' dependent on the modem
 if instr(Buffer,"CONNECTED")>0 Then exit do
 Sleep 100

  if DateDiff("s",Starter,Now)> TimeOut Then
     msgbox "No answer: " + buffer
     exit Sub
  end if
loop

You are now connected
0
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!

 
inthedarkCommented:
So now you keep polling until you reveive a CONNECTION LOST MESSAGE.

Do

  ' get input from modem
  A$=MSC1.Input
  if len(a$) then
    iF INSTR("CONNECTION LOST NO CONNECTION",A$)>0 THEN
       ' You are no longer connected
       exit sub
    End If
  end if
  MSC2.OutPut A$
  A$=MSC2.Input
  if len(a$)>0 then msc1.output a$  
 
loop

But what I would do is log the results to a file and then use MAPI control to send them to you via email. Toy will find this takes a major amount less effort.


Best advice:

Use pcAnywhere! It is excellent at allowing a remote pc to call, connect and totally control a host pc.


But if you realy wan;t to do it the hard way then you may need a bit more info:

You will need Some hayes AT Command Links:

http://www.spiralspider.demon.co.uk/hayes.htm

http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q164660&

You also need so know the modem responses:

http://readthetruth.com/modems.htm
(THis is a good line it even shows how to send/receive faxes.)


More advanced Modem programmer may wish to turn verbose off and use numeric commands.

ATV0 - use numeric messages

Have fun, forever inthedark.......
0
 
shivajivarmaAuthor Commented:
As I have mentioned , I am able to connect to another modem. Connection is not the problem, but transmission of the data is. The first modem has an instrument connected to it which continuously pumps data out. After the modem connects, I am not able to receive anything other than junk in the PC hyperterminal/my comm program.
Probably,the modem is using some kind of protocol like z modem/ x modem etc.
0
 
shivajivarmaAuthor Commented:
Dear inthedark,

we have not used the command

MSCOM1.Output "ATV1"+vbcrlf ' select verbose modem esponses

but modem connects alright. We don't get any meaning ful data. The device which connects to the modem is sending ascii data. we can make that device send any specific string if required. But without doing that itself, connection is made. Baud is 300, both sides.
0
 
inthedarkCommented:
shivajivarma, you are thinking along the right lines.  You must force each modem to use a common protocol.  When your modems connect, you should see a connection message like:

CONNECT9600

If you don't use verbose you will get a number which you have to inperpret from the modem's documentation.  In the old days modems were shipped with the complete programmer's reference, but nowdays it is hard to find any documentation at all.

You must use verbose to start with to see what the default connection is being made by the modem.

Check that you are using a common baude rate for you connection.  Try 9600 AT BOTH ENDS.  Also set a scefic protocol, compatible with your baud rate:

Send "ATF8" to select V.32 bis or V.32 9600.

The problem now is how to force use of V.32 9600

There is also a problem in that  some modems are not exactly hayes compatible.  While reseaching this issue I found this:


\ _^/    ,^,
 \>@@</   ((       "Out of order, there is chaos.
  (..)    );)       Out of chaos, there is order."
   vv\^^^^ /
  /==  ))) )
 ( ==/ )=< \
{{{)=(}}}(_}}}

If use of "ATF8" and using baud rate 9600 does not fix it post another message.
0
 
shivajivarmaAuthor Commented:
thanks a lot sir. Lemme try and come back to you
0
 
inthedarkCommented:
p.s. Unless the connection strings at both ends are not the same it won't work.

0
 
shivajivarmaAuthor Commented:
Dear inthedark,

I am still trying. I am not sure whether the current modems are hayes compatable. Please bear with me.

0
 
inthedarkCommented:
I always use PC anywhere to monitor another pc.
0
 
shivajivarmaAuthor Commented:
Thank you for the help. Your comments were helpful. I guess the problem is with the modem.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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