MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / sockSend

Method sockSend

lib/host/wasi/inode-win.cpp:1843–1869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1841}
1842
1843WasiExpect<void> INode::sockSend(Span<Span<const uint8_t>> SiData,
1844 __wasi_siflags_t,
1845 __wasi_size_t &NWritten) const noexcept {
1846 EXPECTED_TRY(detail::ensureWSAStartup());
1847
1848 std::size_t TotalBufSize = 0;
1849 for (auto &IOV : SiData) {
1850 TotalBufSize += IOV.size();
1851 }
1852 std::vector<uint8_t> TotalBuf(TotalBufSize);
1853 Span<uint8_t> TotalBufView(TotalBuf);
1854 for (auto &IOV : SiData) {
1855 std::copy_n(IOV.begin(), IOV.size(), TotalBufView.begin());
1856 TotalBufView = TotalBufView.subspan(IOV.size());
1857 }
1858 assuming(TotalBufView.empty());
1859
1860 if (auto Res = send(Socket, reinterpret_cast<char *>(TotalBuf.data()),
1861 static_cast<int>(TotalBuf.size()), 0);
1862 unlikely(Res == SOCKET_ERROR_)) {
1863 return WasiUnexpect(detail::fromWSALastError());
1864 } else {
1865 NWritten = static_cast<__wasi_size_t>(Res);
1866 }
1867
1868 return {};
1869}
1870
1871WasiExpect<void> INode::sockSendTo(Span<Span<const uint8_t>> SiData,
1872 __wasi_siflags_t,

Callers 1

bodyMethod · 0.45

Calls 10

ensureWSAStartupFunction · 0.85
unlikelyFunction · 0.85
WasiUnexpectFunction · 0.85
fromWSALastErrorFunction · 0.85
subspanMethod · 0.80
EXPECTED_TRYFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected