MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / Bind

Method Bind

Kernel/src/net/ipsocket.cpp:23–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23int IPSocket::Bind(const sockaddr* addr, socklen_t addrlen){
24 const sockaddr_in* inetAddr = (const sockaddr_in*)addr;
25
26 if(addr->family != InternetProtocol){
27 Log::Warning("[UDPSocket] Invalid address family (not IPv4)");
28 return -EINVAL;
29 }
30
31 if(addrlen < sizeof(sockaddr_in)){
32 Log::Warning("[UDPSocket] Invalid address length");
33 return -EINVAL;
34 }
35
36 address = inetAddr->in_addr.s_addr;
37 port.value = inetAddr->sin_port; // Should already be big endian
38
39 return 0;
40}
41
42int IPSocket::Connect(const sockaddr* addr, socklen_t addrlen){
43 return -ENOSYS;

Callers

nothing calls this directly

Calls 1

WarningFunction · 0.85

Tested by

no test coverage detected