Solved

ident server

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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