Solved

connect to another com-port  through modem

Posted on 2002-03-13
12
258 Views
Last Modified: 2007-12-19
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
Comment
Question by:shivajivarma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 

Expert Comment

by:bill02
ID: 6861378
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
 
LVL 17

Expert Comment

by:inthedark
ID: 6861667
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
 
LVL 17

Expert Comment

by:inthedark
ID: 6861697
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
Independent Software Vendors: 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!

 
LVL 17

Accepted Solution

by:
inthedark earned 300 total points
ID: 6861760
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
 

Author Comment

by:shivajivarma
ID: 6871093
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
 

Author Comment

by:shivajivarma
ID: 6873544
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
 
LVL 17

Expert Comment

by:inthedark
ID: 6873626
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
 

Author Comment

by:shivajivarma
ID: 6873640
thanks a lot sir. Lemme try and come back to you
0
 
LVL 17

Expert Comment

by:inthedark
ID: 6873852
p.s. Unless the connection strings at both ends are not the same it won't work.

0
 

Author Comment

by:shivajivarma
ID: 6904555
Dear inthedark,

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

0
 
LVL 17

Expert Comment

by:inthedark
ID: 6904575
I always use PC anywhere to monitor another pc.
0
 

Author Comment

by:shivajivarma
ID: 6952843
Thank you for the help. Your comments were helpful. I guess the problem is with the modem.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel VBA, find a string in a column, update a cell 7 118
Advice in Xamarin 21 121
How to read File Date Created using VB6 8 73
Macro problems with Excel file 6 53
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question