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

Get Client ip and port after he connected with out transmitting a message #47

Open radu3521 opened 6 years ago

radu3521 commented 6 years ago

Hi, i have a quick question.How can you get the connected client IP and Port after he connected with out using the data receive function. What i am trying to say, is how can you get the ip and port of the client with out him sending a message

ghost commented 5 years ago

Something like this maybe?:

server.ClientConnected += (client, sender) =>
            {                                
                Console.WriteLine(sender.Client.RemoteEndPoint.ToString() + "connected";);
            };