MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / Socket

Method Socket

tools/streamer_recorder/PracticalSocket.cpp:83–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81// Socket Code
82
83Socket::Socket(int type, int protocol) throw(SocketException) {
84 #ifdef WIN32
85 if (!initialized) {
86 WORD wVersionRequested;
87 WSADATA wsaData;
88
89 wVersionRequested = MAKEWORD(2, 0); // Request WinSock v2.0
90 if (WSAStartup(wVersionRequested, &wsaData) != 0) { // Load WinSock DLL
91 throw SocketException("Unable to load WinSock DLL");
92 }
93 initialized = true;
94 }
95 #endif
96
97 // Make a new socket
98 if ((sockDesc = socket(PF_INET, type, protocol)) < 0) {
99 throw SocketException("Socket creation failed (socket())", true);
100 }
101}
102
103Socket::Socket(int sockDesc) {
104 this->sockDesc = sockDesc;

Callers

nothing calls this directly

Calls 1

SocketExceptionClass · 0.85

Tested by

no test coverage detected