bool Socket::ccConnect() { #if 1 // runtime error on ios CCAssert(strlen(m_oInetAddress.getIp()) && m_oInetAddress.getPort() != 0, "_connect"); #endif if( m_uSocket == INVALID_SOCKET ) { if(!ccInit()) { return false; } } int nRet = ::connect(m_uSocket, m_oInetAddress, m_oInetAddress.getLength()); if( nRet == 0 ) { return true; } else { #if( CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 ) int nError = WSAGetLastError(); if( nError == WSAEWOULDBLOCK ) { return true; } else { return false; } #endif #if( CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID ) if( nRet == SOCKET_ERROR && errno == EINPROGRESS ) { return true; } else { return false; } #endif } }
/** * Initialize the pSipcc stack. * @return */ cc_return_t CC_Service_init() { //Initialize stack return ccInit(); }