Skip to content

Client hostname is hardcoded to "Walter", making ClientApp unrunnable elsewhere #10

Description

@dmccoystephenson

Problem

ClientApp.java:13 hardcodes the server hostname:

String hostname = "Walter";
int number = 2000;
Client client = new Client(hostname, number);

"Walter" resolves on one machine. Anywhere else, Client.initializeSocket() fails, prints Something went wrong when initializing the socket with port 2000., and the client is unusable — there is no way to point it at a different host without editing and recompiling the source.

The port variable is also misnamed: int number = 2000 shadows the domain meaning of "number" used everywhere else in this codebase (the number being squared).

Evidence

Read from src/SimpleServer/client/ClientApp.java lines 12-15 and src/SimpleServer/client/Client.java lines 49-57. No run was performed in the session that filed this issue, so the observed failure output above is UNVERIFIED — it is derived from the catch block at Client.java:53-56, not from a real connection attempt.

Proposed change

The hostname and port should be readable from args, with the current values kept as defaults so the no-argument invocation still behaves as it does today. The number variable should be renamed to port.

Related: the constructor ignores the failure it is told about — see the separate issue on discarded initialize* return values.


This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

drafted by Claude on behalf of Daniel Stephenson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions