// -------------------------------------------------- void UClientSocket::open(Host &rh) { sockNum = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); if (sockNum == INVALID_SOCKET) throw SockException("Can`t open socket"); setBlocking(false); #ifdef DISABLE_NAGLE setNagle(false); #endif setBufSize(65535); host = rh; memset(&remoteAddr,0,sizeof(remoteAddr)); remoteAddr.sin_family = AF_INET; remoteAddr.sin_port = htons(host.port); remoteAddr.sin_addr.s_addr = htonl(host.ip); }
// -------------------------------------------------- void WSAClientSocket::open(Host &rh) { #pragma warning(disable : 4244) sockNum = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); #pragma warning(default : 4244) if (sockNum == INVALID_SOCKET) throw SockException("Can`t open socket"); setBlocking(false); #ifdef DISABLE_NAGLE setNagle(false); #endif host = rh; memset(&remoteAddr,0,sizeof(remoteAddr)); remoteAddr.sin_family = AF_INET; remoteAddr.sin_port = htons(host.port); remoteAddr.sin_addr.S_un.S_addr = htonl(host.ip); }