Jump to content
Xtreme .Net Talk

IRC Connetivity in VB .NET


Recommended Posts

Posted

I've been fiddling around with VB.net and for the past week trying to figure out how to write a very very simple IRC client - unfortunately the new microsoft sockets stuff is far too confusing for me.

 

So can anyone PLEASE tell me how to connect-to and send-messages-to and read-messages-from an IRC server.

 

So basically I want a VERY VERY VERY simple IRC client - from then on, I can build upon it. I just dont know how to connect to, send messages to, and read messages from IRC. (using vb .net)

 

W13

 

:D

  • *Experts*
Posted

Perfect timing... I'm working on a VB.NET IRC bot as I type this.

Assuming you already know the simple parts of the IRC protocol,

you should download 101 VB.NET examples. There is an example

for using the sockets namespace to send and receive data

between a client a server. It will help you understand how

asynchronous sockets work, and you can even use the sockets

code from the client in your IRC client (that's what I did, with some

changes of course.)

 

Good luck.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

Thanks a lot - but I am still unable to simplify that code - it is several pages long and I have no idea whats going on.

 

Until now, I've sort of put together this much:

 

Imports System.Net.Sockets
Imports System.Text

Public Class frmMain
   Inherits System.Windows.Forms.Form
   Private client As TcpClient

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       client = New TcpClient("irc.jurai.org", 6667)

   End Sub

   Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
       SendData("/nick Zombee")
       SendData("/join #zombee")
   End Sub

   Private Sub SendData(ByVal data As String)
       Dim writer As New IO.StreamWriter(client.GetStream)
       writer.Write(data & vbCr)
       writer.Flush()
   End Sub

End Class

 

I'm pretty sure I'm missing loads of essential code but I really cant tell. From the one I have put together (which doesn't work btw), I understand about 1% of! lol.

 

Can someone please help. :D

 

W13

  • *Gurus*
Posted

Yes, you're missing loads of essential code. The commands you're sending the server aren't part of the IRC protocol. You are under the impression that you send the IRC server the same commands that you type in to your IRC client and they'll just work, which isn't the case.

 

You need to read RFC 1459 and make sure you understand it, then learn asynchronous sockets. Aside from answering specific questions, it's out of the scope of this forum to teach you how to do that.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...