Solved

ident server

Posted on 2003-11-09
5
229 Views
Last Modified: 2010-04-16
i need to know how to connect to an ident server and get a username. Any help would be appreciated.

Thank you
0
Comment
Question by:GoRgOn
  • 2
5 Comments
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9710575
0
 

Author Comment

by:GoRgOn
ID: 9710836
ive already looked at that. i need to know how to connect to an ident server from C# and the retrieve a username.
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 125 total points
ID: 9710984
string GetIdent(int serverPort, int clientPort)
{
    const string identServerAddr = "192.168.0.1"; // replace with the ip of the ident server

    string returndata = null;

    TcpClient tcpClient = new TcpClient();
    try{
        tcpClient.Connect(identServerAddr, 113);
        NetworkStream networkStream = tcpClient.GetStream();

        if(networkStream.CanWrite && networkStream.CanRead){

            string request;
            request = string.Format("{0}, {1}\r\n", serverPort, clientPort)          
            Byte[] sendBytes = Encoding.ASCII.GetBytes();
            networkStream.Write(sendBytes, 0, sendBytes.Length);
     
            byte[] bytes = new byte[tcpClient.ReceiveBufferSize];
            networkStream.Read(bytes, 0, (int) tcpClient.ReceiveBufferSize);
 
           returndata = Encoding.ASCII.GetString(bytes);
           tcpClient.Close();
          }
       }
       catch (Exception e ) {
                  Console.WriteLine(e.ToString());
    }
    return returndata;
}

I don't have an ident server running, so i didn't test it.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question