AnyPS5/docs/dev/debt/libSceNet.md

5.1 KiB

libSceNet technical debt

Unknown function info

Functional

  • sceNetSetsockopt (libSceNet) sets SO_RCVTIMEO and SO_SNDTIMEO as the host socket's timeouts. On Windows a receive or send on a stream socket that times out fails with ETIMEDOUT, where FreeBSD returns EAGAIN or the partial count: Winsock leaves the connection in an indeterminate state after a timeout and reports no partial count (SOL_SOCKET options), so FreeBSD's behaviour needs the timeout waited for without the host option. A receive on a datagram socket that times out fails with EAGAIN
  • sceNetGetsockopt (libSceNet) reads SO_ERROR from the host socket. Winsock does not clear a socket's pending error when it is read, so on Windows the library reports a pending error once and shows it again only after a new sceNetConnect; a second failure with the same code on the same socket without a sceNetConnect in between would be hidden.
  • sceNetSendmsg and sceNetRecvmsg (libSceNet) copy the scatter/gather list through one host buffer and accept only the flags sceNetSend/sceNetRecv accept. Sending control data throws; a receive never returns control data (msg_controllen 0), since no socket option that queues it is supported
  • sceNetResolverAbort and sceNetResolverStartNtoaMultipleRecords (libSceNet) follow shadPS4 (net.cpp, net_resolver.cpp); the (int rid, int flags) signature of the abort also matches SharpProspero. Unverified on hardware. Lookups run synchronously over the host resolver, which cannot be interrupted: an abort while a lookup runs on another thread returns at once, and that lookup fails with EINTR without writing its output only when the host call returns; the abort flags are then ignored, as shadPS4 does for a running lookup. With nothing running, abort flag 1 (NTOA preservation) or 2 (ATON preservation) makes the next sceNetResolverStartNtoa* or sceNetResolverStartAton call on that resolver fail with EINTR, reported by sceNetResolverGetError, after its arguments are checked. Unlike shadPS4, which ignores them, other abort flag bits throw, and sceNetResolverStartNtoaMultipleRecords throws for any flag, including async (1) and 0x10000 (IP address literals disabled), as sceNetResolverStartNtoaMultipleRecordsEx does
  • sceNetResolverStartNtoa6 (libSceNet) resolves a host name to its first IPv6 address through the host resolver (getaddrinfo with AF_INET6) and writes the 16-byte address; the (rid, hostname, addr, timeout, retry, flags) signature follows sceNetResolverStartNtoa. A name with no IPv6 address fails with RESOLVER_ENODNS (0x804101E1) like a failed lookup; whether the console returns IPv4-mapped addresses instead is not verified. Timeout and retry are ignored as in sceNetResolverStartNtoa, and any nonzero flags throw because their meaning for this call is not known. Unverified on hardware.