void SIMClientSocket::connect(const char *_host, int _port) { port = _port; host = _host; log(L_DEBUG, "Connect to %s:%u", host.c_str(), port); if (inet_addr(host.c_str()) == INADDR_NONE){ log(L_DEBUG, "Start resolve %s", host.c_str()); SIMSockets *s = static_cast<SIMSockets*>(getSocketFactory()); QObject::connect(s, SIGNAL(resolveReady(unsigned long, const char*)), this, SLOT(resolveReady(unsigned long, const char*))); s->resolve(host.c_str()); return; }
void SIMClientSocket::connect(const char *_host, unsigned short _port) { port = _port; host = _host; #ifdef WIN32 bool bState; if (get_connection_state(bState) && !bState){ QTimer::singleShot(0, this, SLOT(slotConnectionClosed())); return; } #endif log(L_DEBUG, "Connect to %s:%u", host.c_str(), port); if (inet_addr(host.c_str()) == INADDR_NONE){ if (!host.empty() && (host[host.length() - 1] != '.')) host += "."; log(L_DEBUG, "Start resolve %s", host.c_str()); SIMSockets *s = static_cast<SIMSockets*>(getSocketFactory()); QObject::connect(s, SIGNAL(resolveReady(unsigned long, const char*)), this, SLOT(resolveReady(unsigned long, const char*))); s->resolve(host.c_str()); return; } resolveReady(inet_addr(host.c_str()), host.c_str()); }