Skip to content

fix(libSceNet): take 0x1105 and 0x1106 as the send and receive timeouts - #4610

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
EagleBearerYS:fix/libscenet-sce-socket-timeouts
Oct 13, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
EagleBearerYS:fix/libscenet-sce-socket-timeouts

Conversation

@EagleBearerYS

@EagleBearerYS EagleBearerYS commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNetSetsockopt and sceNetGetsockopt answered EOPNOTSUPP for 0x1105 and 0x1106, the SCE send and receive timeouts (an int in microseconds); only FreeBSD's 0x1005 and 0x1006 were known. A title that set a receive timeout this way lost it, and a later sceNetRecv on an idle socket blocked for good:

main This branch
sceNetSetsockopt(s, 0xffff, 0x1106, 200000) 0x8041012d (errno 45) 0
sceNetGetsockopt(s, 0xffff, 0x1106) 0x8041012d (errno 45) 0, value 200000
sceNetSetsockopt / sceNetGetsockopt with 0x1105 errno 45 / errno 45 0 / 200000
sceNetRecv on an empty UDP socket afterwards still blocked after 3 s 0x80410123 (EAGAIN) after 200 ms

Both options now set and read the timeouts that 0x1005 and 0x1006 already do; 0x1005 and 0x1006 are unchanged.

Values: shadPS4 net_types.h (ORBIS_NET_SO_SNDTIMEO/RCVTIMEO, read as microseconds in net.cpp), SharpProspero Socket.cs (SoSndTimeo/SoRcvTimeo, "in microseconds") and KytyPS5 network.cpp (0x1105 to SO_SNDTIMEO). Not measured on a console. PPSA34501 sets 0x1105 = 10000 on its UDP game sockets (seen in #2745, closed by the intake pause). #4371 changes the same function for libkernel's FreeBSD-numbered path; the two merge cleanly.

Tested

Windows 11 (10.0.26300), WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT), Release, -DBUILD_TESTING=ON, on main at 2a5eca1:

  • With main's Export.cpp, the new CheckMicrosecondTimeouts in guest_sce_net aborts (exit 0xc0000409); guest_sce_net passes on main itself, IPv6 checks included, so the abort is the new check. With the change it passes, 20 runs in a row.
  • All 128 tests registered in core/libs/prx/libc/CMakeLists.txt and core/libs/prx/libkernel/CMakeLists.txt that build on Windows pass, and so do the network tests (guest_datagram_recv, guest_datagram_recvfrom, guest_datagram_sceNetRecv, guest_datagram_sceNetRecvfrom, guest_udp, guest_resolver, guest_posix_filesystem).

Linux (Ubuntu 24.04, GCC 13.3, Release), base 33ae282: the new CheckMicrosecondTimeouts in guest_sce_net aborts on main at sceNetSetsockopt(..., 0x1106, ...) == 0 (errno 45) and passes with the change, 20/20; the libSceNet, libc and libkernel tests are unchanged. Again on WSL2 (Ubuntu 24.04, GCC 13.3.0, Release with CI's configure flags), merged into main at c952c2b, IPv6 checks included: it aborts with main's Export.cpp and passes with the change, 20 runs in a row.

tools/check_conventions.py --base origin/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

sceNetSetsockopt and sceNetGetsockopt answered EOPNOTSUPP for 0x1105 and
0x1106, the SCE send and receive timeouts in microseconds (shadPS4
net_types.h ORBIS_NET_SO_SNDTIMEO/RCVTIMEO, SharpProspero Socket.cs
SoSndTimeo/SoRcvTimeo, KytyPS5 network.cpp). A title that set a receive
timeout this way then blocked in sceNetRecv for good. Both options now
set and read the timeouts that 0x1005 and 0x1006 already do.
@github-actions github-actions Bot added the prx label Oct 12, 2026
boykopovar#4673 adds a function after receive_error, so defining timeout_option there made the two pull requests conflict.
…on apart from new neighbours

boykopovar#4988 adds a constant after NET_SO_RCVTIMEO and boykopovar#4989 adds a function before receive_error, so defining the SCE timeout constants and timeout_option there made the pull requests conflict.
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on current main: guest_sce_net and the libSceNet/libs ctest scope pass; the new CheckMicrosecondTimeouts fails with main's Export.cpp. 0x1105/0x1106 map to the same int-microsecond timeouts as 0x1005/0x1006 in set and get, matching shadPS4, SharpProspero and KytyPS5. Merging once the full Build is green.

@adriadam10
adriadam10 merged commit 2f6ae9f into boykopovar:main Oct 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants