MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / InitSocket

Method InitSocket

src/Nazara/Network/ENetHost.cpp:321–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319 }
320
321 bool ENetHost::InitSocket(const IpAddress& address)
322 {
323 if (!m_socket.Create(address.GetProtocol()))
324 return false;
325
326 m_socket.EnableBlocking(false);
327 m_socket.EnableBroadcasting(true);
328 m_socket.SetReceiveBufferSize(ENetConstants::ENetHost_ReceiveBufferSize);
329 m_socket.SetSendBufferSize(ENetConstants::ENetHost_SendBufferSize);
330
331 if (address.IsValid() && !address.IsLoopback())
332 {
333 if (m_socket.Bind(address) != SocketState_Bound)
334 {
335 NazaraError("Failed to bind address " + address.ToString());
336 return false;
337 }
338 }
339
340 m_poller.RegisterSocket(m_socket, SocketPollEvent_Read);
341
342 return true;
343 }
344
345 void ENetHost::AddToDispatchQueue(ENetPeer* peer)
346 {

Callers

nothing calls this directly

Calls 10

EnableBlockingMethod · 0.80
EnableBroadcastingMethod · 0.80
IsLoopbackMethod · 0.80
CreateMethod · 0.45
SetReceiveBufferSizeMethod · 0.45
SetSendBufferSizeMethod · 0.45
IsValidMethod · 0.45
BindMethod · 0.45
ToStringMethod · 0.45
RegisterSocketMethod · 0.45

Tested by

no test coverage detected