Skip to content

Multiple clients from localhost #1492

@endertable

Description

@endertable

Hello. OK, this is not really an issue, it's more of a brain fart that I am having. So I have this WSS server up for over a year now and it is working great but now I need to make it where the local host runs a few scripts on it as well. The problem is sometimes multiple scripts will start at the same time and because they both have client IP of 127.0.0.1 the script that runs first will usually receive the answer for both scripts. These scripts send queries to different cameras and need their own distinct responses.

Is there a way I can have the server distinguish between the two requests other than using the IP address? I have been using the IP of the clients as the user_id and has worked great as they have always been different, but now that these local scripts all have an IP of 127.0.0.1 there could be a race issue. I know I can delay the running of concurrent scripts, and if I have to I will, but hoping not.

Is IP the only way to distinguish the different clients or can it also use a remote port or something else?

Am using something like the following in my server (user_id is the IP of client):

await connected_clients[user_id].send(message)

Thanks for any help and for the great software..

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions