fix(libSceNet): stop Winsock failing an unconnected datagram receive after an unreachable port #5295

Closed
ErenYeager1836 wants to merge 1 commit from upstream-pr/5295 into main
ErenYeager1836 commented 2026-10-13 16:40:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ErenYeager1836 on 2026-10-13T16:40:12Z.


What

Winsock reports an ICMP port-unreachable reply as WSAECONNRESET on the subsequent receive of any datagram socket. FreeBSD delivers this error only to a datagram socket explicitly connected to the sender; an unconnected datagram socket sending to a closed port therefore incorrectly suffered a spurious ECONNRESET on a subsequent sceNetRecvfrom.

  • sceNetSocket now clears SIO_UDP_CONNRESET on datagram sockets on Windows.
  • Updates docs/dev/debt/libSceNet.md documenting SIO_UDP_CONNRESET handling.
  • Adds test case CheckDatagramIgnoresUnreachablePort in GuestSceNet.cpp.

Carried from @husseinkad with author attribution preserved.

Tested

guest_sce_net test suite in ctest. Passes conventions check.

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 under Silent stubs in their library's technical debt file
  • 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: #4669, #4758
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4846433308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5295). Originally posted by [ErenYeager1836](https://github.com/ErenYeager1836) on 2026-10-13T16:40:12Z. --- ### What Winsock reports an ICMP port-unreachable reply as `WSAECONNRESET` on the subsequent receive of any datagram socket. FreeBSD delivers this error only to a datagram socket explicitly connected to the sender; an unconnected datagram socket sending to a closed port therefore incorrectly suffered a spurious `ECONNRESET` on a subsequent `sceNetRecvfrom`. - `sceNetSocket` now clears `SIO_UDP_CONNRESET` on datagram sockets on Windows. - Updates `docs/dev/debt/libSceNet.md` documenting `SIO_UDP_CONNRESET` handling. - Adds test case `CheckDatagramIgnoresUnreachablePort` in `GuestSceNet.cpp`. Carried from @husseinkad with author attribution preserved. ### Tested `guest_sce_net` test suite in ctest. Passes conventions check. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #4669, #4758 - [x] Unblocks: none - [x] AI-assisted: yes
likecrank-dotcom commented 2026-10-13 19:12:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by likecrank-dotcom on 2026-10-13T19:12:26Z.


Independent Windows validation by OpenAI Codex (AI-assisted; report authored by an AI):

  • Verified PR head 7b1bbe3b0b70cbc3e4ed8c9eb585b3f85052df23.
  • Built guest_sce_net_tests on Windows 11 Pro (WinLibs GCC 15.2.0, Ninja, CMake/CTest 4.4.4).
  • CTest guest_sce_net passed five consecutive full-suite runs (5/5; 3.05 seconds total). The suite includes CheckDatagramIgnoresUnreachablePort.
  • tools/check_conventions.py and git diff --check passed.

This is focused host validation, not a console or game runtime. No changes were made to the PR branch.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153180097 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5295#issuecomment-6153180097). Originally posted by [likecrank-dotcom](https://github.com/likecrank-dotcom) on 2026-10-13T19:12:26Z. --- Independent Windows validation by OpenAI Codex (AI-assisted; report authored by an AI): - Verified PR head `7b1bbe3b0b70cbc3e4ed8c9eb585b3f85052df23`. - Built `guest_sce_net_tests` on Windows 11 Pro (WinLibs GCC 15.2.0, Ninja, CMake/CTest 4.4.4). - CTest `guest_sce_net` passed five consecutive full-suite runs (5/5; 3.05 seconds total). The suite includes `CheckDatagramIgnoresUnreachablePort`. - `tools/check_conventions.py` and `git diff --check` passed. This is focused host validation, not a console or game runtime. No changes were made to the PR branch.
oneandonlydean commented 2026-10-14 02:29:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:29:26Z.


Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159547070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5295#issuecomment-6159547070). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:29:26Z. --- Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5295
No description provided.