C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-24-2008, 08:20 AM   #1
Registered User
 
Join Date: Nov 2005
Posts: 14
getting ip in service using tcp connection

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:

Code:
string clientAddress = HttpContext.Current.Request.UserHostAddress;
This is great as I can do it inside the service.

But I'm using a TcpChannel as a connection.

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();
        }
    }
}
How can I, inside of the ServerService, get the client IP?

Thanks in advance.

My best regards.
RevengerPT is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TCP IP Modbus boschow Networking/Device Communication 0 03-27-2008 12:20 PM
Obtaining source & destination IP,details of ICMP Header & each of field of it ??? cromologic Networking/Device Communication 1 04-29-2006 02:49 PM
Headers that use each other nickname_changed C++ Programming 7 10-03-2003 04:25 AM


All times are GMT -6. The time now is 11:37 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22