views:

482

answers:

3

Hi, I wanted to use this code to send archives with Xmodem: http://www.java2s.com/Code/Java/Network-Protocol/JModemsimplecommunicationsprogram.htm

In this case, I want to establish a dialup connection between two computers and send a binary file. But this code doesn't let me set a phone number to dial after i setup the port and before I transfer the file. Is there any way of sharing the port with another application that dials the phone number?

A: 

Can't you just send the plain old modem commands over the serial line after connecting the serial port ?

So, after you connect, send ATDT followed by the telephone number. Then wait for the "connect" response string (or error responses). Then send the file.

See: http://en.wikipedia.org/wiki/Hayes_command_set

RoccoD
I have a design issue. Jmodem is used with null-modem cables. I want to use the same program to send an to receive. To dial and answer i need to use events (Ring, CD, DataAvailable.. etc) but I don't know how to distinguish dataavailable event from the data transaction with the modem. Do you have any desing recommendation?
Hi,Hayes compatible modems have a data mode and a command mode. Data mode is used to send data to the other modem. All data you send is seen as data on the other side. Command mode is used to send commands to the modem (like dial etc).Please see:http://en.wikipedia.org/wiki/Command_and_Data_modes_%28modem%29So when you have dialed and are connected the other modem, the modem automaticallu switches to data mode. Send your data and end data mode with "+++" . Now disconnect the connection via the hangup command.What do you mean null modem cables? Not using modems at all ?
RoccoD
A: 

If you don't want to modify the JModem program, then why not use a full-fledged comm program that provides all the features you need? (There used to be a ton of them, but the one that comes to mind right now is kermit). This would be easier than trying to get two different programs to work together.

If you are a Java programmer, then follow RoccoD's suggestion and modify the JModem code to dial a number.

jdigital
A: 

In unix or linux it's not a problem - simply open serial port by all programs simultaneously. also You can use chat or expect.

in windows You need server which will multiplex data-streams

vitaly.v.ch