Skip to content

race problem when starting server with port 0 #362

@PerBothner

Description

@PerBothner

I'm starting the server with a port of 0, so I can then immediately open a client of the server, without hard-wiring in a specific port. Before I start the client, I need to call getPort(). But that may not work, since the server field may not have been set yet, and that happens in a separate thread. My suggestion is to move the initial socket.bind to the start method, before the run method in the new thread. See included patch.

startserver-patch.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions