MCPcopy Create free account
hub / github.com/defold/defold / GetSocket

Function GetSocket

engine/dlib/src/test/test_socket.cpp:128–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128inline dmSocket::Socket GetSocket(dmSocket::Domain domain)
129{
130 dmSocket::Socket instance = 0;
131 uint64_t timeout = 3000; // milliseconds
132 dmSocket::Result result = dmSocket::RESULT_OK;
133
134 result = dmSocket::New(domain, dmSocket::TYPE_STREAM, dmSocket::PROTOCOL_TCP, &instance);
135 if (result != dmSocket::RESULT_OK) return -1;
136
137 result = dmSocket::SetSendTimeout(instance, timeout);
138 if (result != dmSocket::RESULT_OK) return -1;
139
140 result = dmSocket::SetReceiveTimeout(instance, timeout);
141 if (result != dmSocket::RESULT_OK) return -1;
142
143 result = dmSocket::SetNoDelay(instance, true);
144 if (result != dmSocket::RESULT_OK) return -1;
145
146 result = dmSocket::SetQuickAck(instance, true);
147 if (result != dmSocket::RESULT_OK) return -1;
148
149 return instance;
150}
151
152TEST(Socket, BitDifference_Difference)
153{

Callers 2

TYPED_TESTFunction · 0.70
TEST_FFunction · 0.70

Calls 5

NewFunction · 0.50
SetSendTimeoutFunction · 0.50
SetReceiveTimeoutFunction · 0.50
SetNoDelayFunction · 0.50
SetQuickAckFunction · 0.50

Tested by

no test coverage detected