Hi there. I'm building a small chat in which there is a main server that hosts a service, and there are many clients. Each client hosts a service too, so it can get any messages sent by other clients, through a call done by the server.
But I have a little problem. I need to know every client IP. I searched a lot, and I found it to be easier using HttpChannel, where I can just use something like:
This is great as I can do it inside the service.Code:string clientAddress = HttpContext.Current.Request.UserHostAddress;
But I'm using a TcpChannel as a connection.
How can I, inside of the ServerService, get the client IP?Code:namespace Server { class Server { static void Main(string[] args) { TcpChannel channel = new TcpChannel(8086); ChannelServices.RegisterChannel(channel, true); RemotingConfiguration.RegisterWellKnownServiceType( typeof(ServerService), "server", WellKnownObjectMode.Singleton); System.Console.WriteLine("press <enter> to quit..."); System.Console.ReadLine(); } } }
Thanks in advance.
My best regards.



LinkBack URL
About LinkBacks


