--- include\RCF\IpAddress.hpp Mon May 20 10:31:23 2013 +++ include\RCF\IpAddress.hpp Fri Aug 07 10:48:07 2015 @@ -111,6 +111,9 @@ void setPort(int port); + void setAfterCreateSocketCallback(boost::function); + boost::function getAfterCreateSocketCallback() const; + bool operator==(const IpAddress & rhs) const; bool operator!=(const IpAddress & rhs) const; bool operator<(const IpAddress &rhs) const; @@ -126,6 +129,7 @@ std::string mIp; int mPort; + boost::function mAfterCreateSocketCallback; }; class RCF_EXPORT IpAddressV4 : public IpAddress --- src\RCF\IpAddress.cpp Sun May 31 06:31:59 2015 +++ src\RCF\IpAddress.cpp Mon Aug 10 12:41:09 2015 @@ -233,7 +233,11 @@ int family = (mType == V4) ? PF_INET : PF_INET6 ; +#ifdef BOOST_WINDOWS + int fd = static_cast( ::WSASocketW(family, socketType, protocol, NULL, 0, WSA_FLAG_OVERLAPPED)); +#else int fd = static_cast( ::socket(family, socketType, protocol) ); +#endif int err = Platform::OS::BsdSockets::GetLastError(); RCF_VERIFY( @@ -241,6 +245,9 @@ Exception( _RcfError_Socket("socket()"), err, RcfSubsystem_Os)); + if (mAfterCreateSocketCallback) + mAfterCreateSocketCallback(fd); + return fd; } @@ -530,6 +537,16 @@ mAddrV6.sin6_port = htons( static_cast(port) ); } } + } + + void IpAddress::setAfterCreateSocketCallback(boost::function callback) + { + mAfterCreateSocketCallback = callback; + } + + boost::function IpAddress::getAfterCreateSocketCallback() const + { + return mAfterCreateSocketCallback; } std::string IpAddress::string() const --- src\RCF\TcpClientTransport.cpp Sun May 31 06:31:59 2015 +++ src\RCF\TcpClientTransport.cpp Mon Aug 10 14:07:14 2015 @@ -107,6 +107,7 @@ { if (mConnectionAddr != mServerAddr) { + mServerAddr.setAfterCreateSocketCallback(mConnectionAddr.getAfterCreateSocketCallback()); mConnectionAddr = mServerAddr; } }