modem disconnect

modem disconnect

Post by Robert William Love I » Sun, 08 Jul 2001 06:55:44



Hey,
        I have written code to disconnect a modem from a server, but
it always fails. Can anyone see anything that is wrong with this...

I always get this "Error in int Modem::hangup(): could not drop the
carrier,"

m_cEscapeString = "+++\r"
m_cHangupSting = "ATH\r"

bool carrier()
{
  int status = 0;
  ioctl(getFd(), TIOCMGET, &status);
  if (status & TIOCM_CD)
    return true;
  return false;

Quote:}

HERE IS THE CODE

      //Drop the DTR
      int status = 0;
      ioctl(getFd(), TIOCMGET, &status);
      status &= ~TIOCM_DTR;
      ioctl(getFd(), TIOCMSET, status);
      msleep(1000);
      //Raise the DTR
      ioctl(getFd(), TIOCMGET, &status);
      status |= TIOCM_DTR;
      ioctl(getFd(), TIOCMSET, status);
      msleep(1000);

      if (carrier())
      {
        _serialWrite(m_cEscapeString, strlen(m_cEscapeString));
        msleep(100);
        _serialWrite(m_cHangupString, strlen(m_cHangupString));
        msleep(100);
        tcdrain(getFd());
      }

      if (carrier())
      {
          cout << "Error in int Modem::hangup(): could not drop the
carrier,"
               << " closing the file descriptor" << endl;
        closeFd();
        return false;
      }
      else
      {
        cout << "hangup successfull" << endl;
        closeFd();
        return true;
      }
    }
    else
    {
      cout << "hangup successfull, but only because I wasn't ever
connected" << endl;
      return true;
    }
  }
  else
    cout << "not a valid file descriptor" << endl;
  return true;

 
 
 

1. zoom FAX/modem Internal : Modem disconnects.

Hi,

I am running Red Hat 6.0. My modem is an internal zoom fax/modem 56k
dual mode. When i dial to my isp (earthlink) using minicom, it dials
properly and asks me for my username and password, and immediately after
confirming my login is correct, hangs up. minicom gives message "No
carrier found".

Could somebody help out.

TIA
Shyam


2. A problem of pipe .segmentation falut ??

3. How to enable PPPD reconnected automatically after modem disconnect ?

4. stupid unix questions

5. Modem disconnect garble screws up my terminal character set

6. Electrical Power

7. Modem disconnects with RH5.2

8. Help with SLIP using dip and slirp

9. : Modem disconnected right after it is connected

10. modem disconnect

11. Modem disconnecting

12. modem disconnecting after short time

13. modem disconnect on incoming ppp call