Hi, I have a Cobra connected to a Multi-Tech analog dial-up modem. I am trying to establish socket connectivity via PPP.
Using the example code, I can get the modem to respond to commands and dial, connect, and everything is OK through PPP.Enable.
When I call PPP.Connect, I only can get a PPP.ConnectionStatus.Connection_Faild response. Does anyone have an idea of what I can try?
Using TeraTerm I can control the modem and connect to an ISP with required information (username, password). Trying the same thing through PPP.Connect() won’t work for me.
Perhaps there is a way to get more information about what may be failing?
OK, I’m still having the problem. I made this very simple example code to illustrate problem. I stripped out everything and made this just for clarity.
SerialPort aPort = new SerialPort("COM1", 115200, Parity.None, 8, StopBits.One);
PPP.Enable(aPort);
aPort.Handshake = Handshake.RequestToSend;
aPort.Open();
NetworkInterface[] netif = NetworkInterface.GetAllNetworkInterfaces();
aPort.DiscardInBuffer();
string aDialCmd = "ATD9010997\r";
string aSerialReturnStr = "";
aPort.Write(Encoding.UTF8.GetBytes(aDialCmd), 0, aDialCmd.Length);
//Wait a good long time to allow modem to establish connection.
Thread.Sleep(20000);
//Read result
while (aPort.BytesToRead > 0)
{
int aRespLen = aPort.BytesToRead;
byte[] aResponse = new byte[aRespLen];
aPort.Read(aResponse, 0, aRespLen);
aSerialReturnStr += new string(Encoding.UTF8.GetChars(aResponse));
}
aPort.DiscardInBuffer();
switch (PPP.Connect("myUserID", "myPASSWORD"))
{
case PPP.ConnectionStatus.Authentication_Faild:
Debug.Print("Authentication_Faild");
break;
case PPP.ConnectionStatus.Connection_Faild:
Debug.Print("Connection_Faild");
break;
case PPP.ConnectionStatus.Connected:
// PPP setting will overload the first interface settings since only one interface is supported.
netif = NetworkInterface.GetAllNetworkInterfaces();
Debug.Print("PPP Network settings:");
Debug.Print("IP Address: " + netif[0].IPAddress);
Debug.Print("Subnet Mask: " + netif[0].SubnetMask);
Debug.Print("Default Getway: " + netif[0].GatewayAddress);
Debug.Print("DNS Server: " + netif[0].DnsAddresses[0]);
network_is_read = false;
break;
case PPP.ConnectionStatus.Disconnected:
Debug.Print("Disconnected");
break;
}
So everything works just fine, the modem dials, connects, I get the CONNECTED 115200 string back from serial port and then PPP.Connect() returns Connection_Faild after about 30 seconds of waiting. What can I try? Thanks for any ideas anyone might have.
Yes I did try this, with two separate ISP’s who both told me that they accept PAP.
I accomplished successful connection via windows’s modem software (from network connections)and selected from Security Tab ‘No Encryption Allowed’ and also under Allow These Protocols selected ONLY ‘Unencrypted Password PAP’ (CHAP is also an option there that I left UNselected.)
Connection works when dialed. Thanks for your ideas so far Joe, is there anything else I can investigate? You can see that my sample code is very simple. I can try any other test!
Yes,I used the ATCommand code exactly (well, with small mods for modem stuff). My small test code boils it down to see very easily the progression of calls to GHI code.
I have been using two ISPs, just for testing purposes, Netzero and BasicISP. Reps from both companies stated that PAP works fine with any of their access numbers.
Is it possible to include any GHI code in my project for debugging purposes? Not sure if that is the way things get done here but can’t hurt to ask as I am new to this.
Success!! I was able to finally get PPP.Connect() to work after I discovered that the voltages were incorrect on my TTL implementation. RTS was never going LOW, this was due to my modem development board being powered separately from the Cobra. Now the Cobra powers the modem, and the voltages are now correct (via COM2, and Handshake.RequestToSend).