Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Server Send does not work #48

Open
@mahmah2

Description

@mahmah2

Hi,

I have got stuck in a weird situation. I want to initiate a send from the server side to all of the clients. So logically this should work:

                private IServer _server
                 ...
                var connections = _server.GetConnections().GetConnections();
               
                foreach (ITcpConnection connection in connections)
                {
                    connection.Socket.Send(Encoding.ASCII.GetBytes("COMMAND1"));
                }

But client doesn't receive this command.

Now if I save the server context somewhere and reuse it later it works:

private ISender _sender;

ServerPacketHandler_OnProcess(object sender, string e)
{
            _sender = (sender as IPacketContext).Sender;
}

Now this one will work :

                _sender.Send<string>("COMMAND1");`

What is the correct way of initiating a send from the server. Its not in the example and tests either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions