Although we can't let you try Sockets4AIM online, you can download a sample EXE that uses this component or the source code to a complete Visual Studio.NET C# project that demonstrates how to use this valuable tool. Apart from the GUI, the complete source code to a small, simple instant messenger client is listed below.

Although this application is written in C#, any .NET compatible language can be used with Sockets4AIM.

Download this sample application

Download the Visual Studio project and source code for this application

Screenshots


(click to enlarge)


(click to enlarge)

C# Example:

        private void cmdConnect_Click(object sender, System.EventArgs e)
        {
            if (c.IsConnected())
            {
                c.Disconnect();
                cmdConnect.Text = "Connect";
            } 
            else 
            {
                c.SetDebug(true);         
                c.Connect();
                c.MonitorBuddy("powlette");
                try
                {
                    c.Login(txtUsername.Text, txtPassword.Text, 50000);
                    cmdConnect.Text = "Disconnect";
                }
                catch (Exception)
                {
                    Console.WriteLine("Login error was: " + c.GetLastError());
                }
                
            }
        }
        private void AddMessage(string s)
        {
            lstLog.Items.Add(s.Replace("\n", " "));
            lstLog.SelectedIndex = lstLog.Items.Count-1;
            UpdateStatus();
        }
 
 
        private void cmdSend_Click(object sender, System.EventArgs e)
        {
            SendMessage();
        }
        
        private void SendMessage()
        {
            c.SendIM(cboTo.Text, txtMessage.Text);    
            AddToConversation(txtUsername.Text + " - " + txtMessage.Text);
            txtMessage.Text = "";        
        }
    
        private void UpdateStatus()
        {
            if (c != null)
                txtStatus.Text = "Connected=" + c.IsConnected() + 
                ", LoggedIn=" + c.IsLoggedIn() + ", LastError=" + c.GetLastError();
        }
 
        private void Form1_Load(object sender, System.EventArgs e)
        {
            c = new AIMConnection("toc.oscar.aol.com",9898);
            c.AIMEvents += new AIMEvent(c_AIMEvents);
            UpdateStatus();
        }
        private void AddToConversation(String s)
        {
            txtConversation.Text += s + "\r\n";
            txtConversation.Select(txtConversation.Text.Length, 0);
            txtConversation.ScrollToCaret();
        }
 
        private void c_AIMEvents(object sender, AIMEventArgs a)
        {
            TocResponse resp = a.GetTocResponse();
            Console.WriteLine("In app: ["  + resp + ":" + resp.ToString() + "]");
            if (resp is TocResponseIM)
                AddToConversation(((TocResponseIM)resp).GetFrom() + 
                    " - " + ((TocResponseIM)resp).GetMessage());
            else if (resp is TocResponseBuddyUpdate)
            {
                TocResponseBuddyUpdate bu = (TocResponseBuddyUpdate)resp;
                if (!cboTo.Items.Contains(bu.GetBuddy()))
                    cboTo.Items.Add(bu.GetBuddy());
            }
            else if (resp is TocResponseConfig)
            {
                TocResponseConfig config = (TocResponseConfig)resp;
                ArrayList buddies = config.GetBuddyNames();
                for (int i = 0; i < buddies.Count; i++)
                {
                    cboTo.Items.Add(buddies[i]);
                    c.MonitorBuddy((String)buddies[i]);
                }
                    
            }
            UpdateStatus();
        }
 
        private void txtMessage_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == System.Windows.Forms.Keys.Enter)
                SendMessage();
        }