Skip to content

More than one client connected to the server #184

Answered by LeorFinacre
LeorFinacre asked this question in Q&A
Discussion options

You must be logged in to vote

Hi again,

I just found what the problem was. I come here to post the solution so that it can be useful to someone else.

Just move the assignment row in the MemoryStream in the for each loop

        private void OnClientConnected(object sender, ConnectionEventArgs e)
        {
            dictionnaire.Clear();
            Logger(Severity.Debug, "Client " + e.IpPort + " connected");
            this.Invoke((MethodInvoker)delegate
            {
                listClientIP.Items.Add(e.IpPort);
                clientList.Add(e.IpPort);
                data = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(clientList));
                dictionnaire.Add("simpleData", "clientList");
            …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jchristn
Comment options

Answer selected by LeorFinacre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants