BrandonPotter / SimpleTCP

Straightforward .NET library to handle the repetitive tasks of spinning up and working with TCP sockets (client and server).
Apache License 2.0
368 stars 108 forks source link

server.datareceived can't get the client who sent it #49

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello

I'm trying to develop a small server/client chat with multiple rooms for a school project.

However for a certain reason, i need to know which client(simpletcpclient) sent the data in this thingy:

srv.DataReceived += (sender, msg) =>
            {  
                    list.addclient(sender);
            }

So something like this code above, however the sender is returning as a SimpleTcpServer, i'm stuck and i'd apreciate if someone could lend me a hand here. Thanks for your time

resolved

ghost commented 5 years ago

Ok, sorry lads.

You can actually get the user by doing

msg.tcpclient

not really intuitive though!