// ********************************************************************** // // Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. // // This copy of Ice-E is licensed to you under the terms described in the // ICEE_LICENSE file included in this distribution. // // ********************************************************************** #include #include #include #include #include #include #include using namespace std; using namespace Ice; using namespace IceInternal; void IceInternal::incRef(Connector* p) { p->__incRef(); } void IceInternal::decRef(Connector* p) { p->__decRef(); } TransceiverPtr Connector::connect(int timeout) { if(_traceLevels->network >= 2) { Trace out(_logger, _traceLevels->networkCat); out << "trying to establish tcp connection to " << toString(); } SOCKET fd = createSocket(); setBlock(fd, false); doConnect(fd, _addr, timeout); #ifndef ICEE_USE_SELECT_FOR_TIMEOUTS setBlock(fd, true); #endif if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); out << "tcp connection established\n" << fdToString(fd); } return new Transceiver(_instance, fd); } string Connector::toString() const { return addrToString(_addr); } Connector::Connector(const InstancePtr& instance, const string& host, int port) : _instance(instance), _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger) { getAddress(host, port, _addr); } Connector::~Connector() { }