Author Topic: [VB]IRC connection problem  (Read 1936 times)

0 Members and 1 Guest are viewing this topic.

Offline Kiligolo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 218
  • Rating: +10/-1
    • View Profile
[VB]IRC connection problem
« on: February 22, 2012, 06:28:07 am »
Hello,

I want to make an IRC client in VB.NET but I have a problem at the connection with the server.
I helped myself with Telnet to make my program and to know when I had to send informations, etc.
Code: [Select]
'Ouverture de la connection
        SocketClient.Connect(Serveur, 6667)

        While Not UTF8.GetString(Stream).Contains("End of /MOTD command")
            SocketClient.Receive(Stream)
            tbChat.Text += UTF8.GetString(Stream) + NewLine    'tbChat is the textbox used to display messages received from the server
            tbChat.Refresh()
            Threading.Thread.Sleep(500)

            If UTF8.GetString(Stream).Contains("Found your hostname") Then
                tbChat.Text += "Identification avec le pseudo" + NewLine
                tbChat.Refresh()
                SocketClient.Send(ASCII.GetBytes("NICK " + Pseudo.ToUpper + "\r\n"))
            End If

            If UTF8.GetString(Stream).Contains("PING") Then
                Msg = UTF8.GetString(Stream).Substring(UTF8.GetString(Stream).IndexOf("PING") + 7, 15)
                tbChat.Text += "RĂ©ponse au ping " + Msg + NewLine
                tbChat.Refresh()
                SocketClient.Send(ASCII.GetBytes("PONG :" + Msg + "\r\n"))

                tbChat.Text += "Envoi des informations relatives au client" + NewLine
                tbChat.Refresh()
                If RealName <> "" Then
                    SocketClient.Send(ASCII.GetBytes("USER " + Pseudo.ToUpper + " 0 * :" + RealName + "\r\n"))
                Else
                    SocketClient.Send(ASCII.GetBytes("USER " + Pseudo.ToUpper + " 0 * :" + Pseudo + "\r\n"))
                End If
            End If
        End While
With Telnet, it worked well, the server sent the PING after NICK command and the MOTD after the USER command, but with this program, the server do not send me the PING and Envoi des informations relatives au client (= Sending client informations) is not displayed.
VS10 tell me that My connection is abandonned by a program of my host computer.

Thanks for your help.
Spoiler For Calcul Mental:
Version 1.3 :100%!!
Here is a program that reduces your dependence on the calculator! Click here!
Spoiler For Some screen shots:
       
The screenshots are in french but there is an english version