Skip to content

fix(libSceNet): auto-bind an unbound stream socket on listen - #5349

Closed
MarcZX10 wants to merge 3 commits into
boykopovar:mainfrom
MarcZX10:marc/fix-net-listen-autobind-5339
Closed

MarcZX10 wants to merge 3 commits into
boykopovar:mainfrom
MarcZX10:marc/fix-net-listen-autobind-5339

Conversation

@MarcZX10

Copy link
Copy Markdown
Contributor

What

On Windows, Winsock requires a stream socket to be bound before listen, while FreeBSD implicitly binds an unbound socket to a wildcard address and ephemeral port. Bind an unbound IPv4 or IPv6 socket before listening, and skip that bind when a failed connect has already assigned a local port.

Adds IPv4/IPv6 listen-without-bind coverage, including connect/accept/data exchange, and a regression case for listening after a refused connection. Carries Hussein Kadhim's ready fix branch; its two implementation commits retain his authorship. The final commit moves the test helpers to avoid conflicts with open PRs #4669 and #4988.

Tested

  • Linux x86_64, GCC 12.2, Ninja Release: built guest_sce_net_tests; ctest -R '^guest_sce_net$' passed (1/1).
  • Hussein's issue report records the new cases failing on main and passing on the final branch on Windows, with six successful runs; the Windows build and runtime checks were performed by him.

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; silent stubs are listed in technical debt
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Closes #5339

husseinkad and others added 3 commits October 13, 2026 17:32
… on listen

FreeBSD's tcp_usr_listen binds a socket that has no local port to the
wildcard address and an ephemeral port before it listens. Winsock fails
listen on an unbound socket with WSAEINVAL, so sceNetListen on a socket
the guest never bound failed with EINVAL on Windows.
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4785 core/libs/tests/GuestSceNet.cpp L651
#4989 core/libs/prx/libSceNet/Export.cpp L462
#5536 core/libs/tests/GuestSceNet.cpp L569

@github-actions github-actions Bot added the prx label Oct 13, 2026
@LeandroLP23

Copy link
Copy Markdown
Contributor

Windows check, where the unbound listen fails today: Windows 11 (26300), WinLibs GCC 15.2.0, Release, head dc39e89e1 merged onto main 30f961266.

  • With the PR: guest_sce_net passes (2.5 s).
  • With main's libSceNet/Export.cpp and the PR's test: it fails. The test aborts (exit 0xc0000409), consistent with sceNetListen on an unbound TCP socket failing with EINVAL on Windows.

AI-assisted: yes (Claude Code)

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

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.

libSceNet: sceNetListen on an unbound TCP socket fails with EINVAL on Windows; FreeBSD binds the wildcard address and succeeds; fix branch ready

4 participants