1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2014 projectchrono.org
5 // All rights reserved.
6 //
7 // Use of this source code is governed by a BSD-style license that can be found
8 // in the LICENSE file at the top level of the distribution and at
9 // http://projectchrono.org/license-chrono.txt.
10 //
11 // =============================================================================
12 // Authors: Alessandro Tasora
13 // =============================================================================
14 
15 #include "chrono_cosimulation/ChSocketFramework.h"
16 #include "chrono_cosimulation/ChExceptionSocket.h"
17 
18 namespace chrono {
19 namespace cosimul {
20 
ChSocketFramework()21 ChSocketFramework::ChSocketFramework() {
22 #ifdef WINDOWS_XP
23 
24     // Initialize the winsock library
25     WSADATA wsaData;
26 
27     if (WSAStartup(0x101, &wsaData)) {
28         throw chrono::cosimul::ChExceptionSocket(0, "Error: calling WSAStartup()");
29     }
30 
31 #endif
32 }
33 
~ChSocketFramework()34 ChSocketFramework::~ChSocketFramework() {
35 #ifdef WINDOWS_XP
36     WSACleanup();
37 #endif
38 }
39 
40 }  // end namespace cosimul
41 }  // end namespace chrono
42