]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/jaeger-client-cpp/src/jaegertracing/net/Socket.cpp
2 * Copyright (c) 2017 Uber Technologies, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "jaegertracing/net/Socket.h"
28 namespace jaegertracing
{
37 /* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
38 WORD wVersionRequested
= MAKEWORD(2, 2);
41 int err
= WSAStartup(wVersionRequested
, &wsaData
);
43 std::ostringstream oss
;
44 oss
<< "Failed to find a usable Winsock DLL. WSAStartup failed with "
47 throw std::system_error(errno
, std::system_category(), oss
.str());
50 /* Confirm that the WinSock DLL supports 2.2.*/
51 /* Note that if the DLL supports versions greater */
52 /* than 2.2 in addition to 2.2, it will still return */
53 /* 2.2 in wVersion since that is the version we */
56 if (LOBYTE(wsaData
.wVersion
) != 2 || HIBYTE(wsaData
.wVersion
) != 2) {
59 std::ostringstream oss
;
60 oss
<< "Failed to find a usable Winsock DLL. WSAStartup failed with "
63 throw std::system_error(errno
, std::system_category(), oss
.str());
78 Socket::OSResource::OSResource() { initSocket(); }
80 Socket::OSResource::~OSResource() { cleanSocket(); }
84 } // namespace jaegertracing