tags:

views:

409

answers:

5

Hi Is there any way to connecting to computers via Dial Modem without internet? Like windows Hyper terminal. making connection sending files between computers. Just Connection Between two Computers Directly and sending FIle.

+1  A: 

Someone has written an XModem implementation in C# here: http://trackday.cc/b2evo/blog2.php/2007/08/02/net-xmodem It may help with what you're after.

JLWarlow
thanks. does is able me to send file via modem without internet?
shaahin
It should do. I'm not sure if the code handles dialing and answering the sending and receiving model - but it handles sending and receiving of a files over the com port.
JLWarlow
+3  A: 

The way we used to do it back in the olden days was with a null-modem cable. We even used to do "networked" gaming that way, back in the day.

This is bascially an RS-232 cable with the receive and transmit pins crosswired. I still see some adapters around, so it shouldn't be too tough to get hold of one.

Much later some people created SLIP (Serial Line IP) to enable a serial line to act as a carrier for the entire TCP/IP stack. A bit later PPP was introduced as an improvement. I think SLIP is still available for most platforms, and PPP exists on every platform that can do dial-up internet.

So if the question basically boils down to wanting to network two computers via PPP without going through somebody else's dial-up server (like Earthlink), what you need is to install a PPP server on one of the two machines. They come with most Linux distros. For Windows you will have to go look. I'd help, but my corporate blocker is being overexuberant again.

T.E.D.
You would use a null-modem cable to directly connect to DTE serial ports back to back (or two DCEs), but that is not using modems.
Richard
@Richard, that was sort of my point. If the computers are co-located, you don't need the modems. Modems were created for enabling phone lines to act a long-distance serial lines.
T.E.D.
Connection between two computer using modem without internet needs telephone cable or RS-232 cable ?! i am sorry because of my poor information about this matter.
shaahin
i have to use phone lines for connection.
shaahin
@shaahin - OK. Added some more content to address that
T.E.D.
+3  A: 

Yes.

Assuming the modems are connected via a serial port (or emulate being connected via a serial port): you'll need one modem set up (learn your AT commands!) to listen for and answer incoming calls, and the other to dial the first.

You can then treat the pair as a rather long serial link.

However getting everything to work reliably is more of an art than a science, and something that is so rarely done today that much of it is forgotten. The last time I worked with modems in this way was more than fifteen years ago.

Richard
thanks. i know this is old method. but i have to use this method. thanks for your very useful answer. so have i learn AT Commands to creating connection between two computers? is there any sample exist?
shaahin
@shaddhin: Wikipedia looks like a good intro: http://en.wikipedia.org/wiki/Hayes_command_set There should be more info on the internet, but you'll have to search.
Richard
+1  A: 

You can quite easily setup dial-up network connections within Windows that require the use of a modem (its under the option for setting up a VPN, but you can set it for just a dial up).

So I would assume that you can then map a network location to it for use by your C# code.

As already stated at least one of the modems must be on and listening for a connection.

* edit *

I believe that the following code will trigger a dial-up connection that has been placed within Network Connections

System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo(@"c:\Local Area Connection 2 - Shortcut");

System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();

For link placed at c:\ drive and named "Local Area Connection 2 - Shortcut"

You could then ping the destination to see if its connected.

Ultimately though I think that your best solution may be to use RAS.

Have a look here at Codeplex: DotRAS

You can then use the following code:

RasDialer dialer = new RasDialer();

bool connected = false;
foreach (RasConnection connection in dialer.GetActiveConnections())
{
    if (connection.EntryName == "MyFriendsPC")
    {
        connected = true;
        break;
    }
}

if (!connected) {
    dialer.EntryName = "MyFriendsPC";
    dialer.Dial();

    // If you need to provide credentials, use the Dial(NetworkCredential) overload that's available.
}

This example assumes you already have an entry named MyFriendsPC in the default phone book. If you do not and need to create this connection programmatically, you can use the RasPhoneBook component for that.

RasPhoneBook pbk = new RasPhoneBook();
pbk.Open(); // This will open the phone book in the All Users profile.

RasEntry entry = new RasEntry("MyFriendsPC");

If you'd rather use the default settings for the connection you can use one of the static methods on the RasEntry class, or manually configured the connection here.

pbk.Entries.Add(entry);

Once the entry has been added to the collection, it will immediately be added into the phone book.

ChrisBD
thanks. so i have to create dial connection between two computers ? it is better way because i am not involving with AT Commands. all things you said is available using c# codes? i want and automatic process. for example computer a starting dialing and computer 2 answering automatic.
shaahin
Expanded entry and show use of RAS using codeplex DotRAS dialler.
ChrisBD
+1  A: 

One thing that's not clear from your question is whether you are attempting to directly connect two machines in the same physical location with a cable, or if you are attempting to dial in to one from the other over a PSTN.

If they are in the same place, eliminate the modem from the equation. This reduces complexity significantly.

If they are in separate locations (ie, dialing over an honest-to-God dial-up connection), there is some code here that might help you. The article talks about a Bluetooth or GPRS modem, but the core of it is about sending AT commands which can be used to talk to any AT-command set-compatible device. It might get you going in the right direction.

Update

See http://msdn2.microsoft.com/en-us/system.io.ports.serialport(VS.80).aspx

Since a modem should be attached to a COM port (COM1-COM12) even it is an internal modem, you should be able to use the .NET framework's SerialPort class to open the port, send AT commands, etc. Once you have an open connection, you could use the XModem library to transfer files, or straight serial for regular communications.

Do you need an IP stack, or are you happy with a straight serial protocol?

David Lively
thanks. Dialing without physical Cable. i mean separate locations. Connection between 2 computer wit phone line and dial up modem.
shaahin
What is IP Stack? i want just simple connection and file transfring with progress bar and etc .... thnaks.
shaahin