From 51b0750d54bf9280ae7ca099641b8198e17bb00a Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Sat, 2 Jan 2010 21:35:33 +0000 Subject: [PATCH] In getaddrinfo emulation, only check the socket type (SOCK_STREAM or SOCK_DGRAM) if a service name has been specified. This should allow the emulation to work with raw sockets. [SVN r58650] --- include/boost/asio/detail/socket_ops.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/asio/detail/socket_ops.hpp b/include/boost/asio/detail/socket_ops.hpp index da1e5fdc..475162a3 100644 --- a/include/boost/asio/detail/socket_ops.hpp +++ b/include/boost/asio/detail/socket_ops.hpp @@ -1388,8 +1388,9 @@ inline int gai_echeck(const char* host, const char* service, break; case AF_INET: case AF_INET6: - if (socktype != 0 && socktype != SOCK_STREAM && socktype != SOCK_DGRAM) - return EAI_SOCKTYPE; + if (service != 0 && service[0] != '\0') + if (socktype != 0 && socktype != SOCK_STREAM && socktype != SOCK_DGRAM) + return EAI_SOCKTYPE; break; default: return EAI_FAMILY;