1.
public static Socket GetSocket(TcpClient cln)
        {
            Socket s = cln.Client;
            return s;
        }
        public static string GetRemoteIP(TcpClient cln)
        {
            string ip = GetSocket(cln).RemoteEndPoint.ToString().Split(':')[0];
            return ip;
        }
        public static int GetRemotePort(TcpClient cln)
        {
            string temp = GetSocket(cln).RemoteEndPoint.ToString().Split(':')[1];
            int port = Convert.ToInt32(temp);
            return port;
        }
2.
TCPClient tc = TCPListener.AcceptTcpClient();
Socket s = tc.Client;
Console.WriteLine("I am connected to " +
IPAddress.Parse(((IPEndPoint)s.RemoteEndPoint).Add ress.ToString()) +
"on port number " + ((IPEndPoint)s.RemoteEndPoint).Port.ToString());