[XAM/Net] Implemented NetDll_getsockname

This commit is contained in:
Gliniak
2021-11-17 12:30:39 +01:00
parent 5e31429128
commit 0b90d5edf9
3 changed files with 36 additions and 0 deletions

View File

@@ -257,5 +257,17 @@ bool XSocket::QueuePacket(uint32_t src_ip, uint16_t src_port,
return true;
}
X_STATUS XSocket::GetSockName(uint8_t* buf, int* buf_len) {
struct sockaddr sa = {};
int ret = getsockname(native_handle_, &sa, (socklen_t*)buf_len);
if (ret < 0) {
return X_STATUS_UNSUCCESSFUL;
}
std::memcpy(buf, &sa, *buf_len);
return X_STATUS_SUCCESS;
}
} // namespace kernel
} // namespace xe