Solved

ident server

Posted on 2003-11-09
5
208 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now