Skip to content

Feature/tcp serversocket #4#3

Closed
met4lk1tty wants to merge 2 commits intomainfrom
feature/tcp-serversocket-#4
Closed

Feature/tcp serversocket #4#3
met4lk1tty wants to merge 2 commits intomainfrom
feature/tcp-serversocket-#4

Conversation

@met4lk1tty
Copy link

@met4lk1tty met4lk1tty commented Feb 5, 2026

This PR implements a blocking TCP server using Java ServerSocket.

The server listens on a configurable port and blocks on
ServerSocket.accept() while waiting for incoming TCP connections.
Each accepted connection is handled in a virtual thread.

The server is now properly initiated from the main method in the App class,
ensuring that it starts when the application runs.

This change addresses the requirement described in issue #4:
"Create a blocking TCP server that can accept incoming connections."

Summary by CodeRabbit

  • New Features

    • The application now runs as a network server listening on port 3000 and accepts incoming client connections.
  • Refactor

    • Changed application startup behavior to initialize server operations instead of providing console output.

@met4lk1tty met4lk1tty self-assigned this Feb 5, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

The application's entry point now delegates to a newly created SocketServer class instead of printing output. The SocketServer implements a network service that listens on port 3000, accepts incoming client connections, and delegates each client to a virtual thread for processing.

Changes

Cohort / File(s) Summary
Server Initialization
src/main/java/org/example/App.java, src/main/java/org/example/SocketServer.java
App.main() now delegates to SocketServer.main(). SocketServer introduces a socket server listening on port 3000 using ServerSocket with try-with-resources, spawning virtual threads per client connection and forwarding to handleClient() for socket closure.

Sequence Diagram

sequenceDiagram
    participant Client
    participant SocketServer
    participant VirtualThread
    
    App->>SocketServer: main()
    activate SocketServer
    SocketServer->>SocketServer: Create ServerSocket(3000)
    SocketServer->>SocketServer: Log startup
    loop Accept connections
        Client->>SocketServer: Connect
        SocketServer->>VirtualThread: Spawn virtual thread
        activate VirtualThread
        VirtualThread->>VirtualThread: handleClient(socket)
        VirtualThread->>Client: Close socket
        deactivate VirtualThread
    end
    deactivate SocketServer
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A server springs forth from the code,
Virtual threads down the network road,
Port three-thousand now wide awake,
Connections flowing for goodness sake! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feature/tcp serversocket #4' is partially related to the changeset. It references the TCP server feature and issue number, but uses a vague branch-like naming convention and lacks clarity about the main change for someone scanning PR history. Consider revising the title to be more descriptive, such as 'Add blocking TCP server with ServerSocket and virtual thread handling' or 'Implement TCP server that accepts incoming connections on port 3000'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@met4lk1tty met4lk1tty closed this Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant