Solved

ident server

Posted on 2003-11-09
5
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

728 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