En IRC-klient skriven i VB.net och CSharp

Jag hittade precis den här kodbiten som tydligen är en simpel IRC-klient skriven i VB.net. (på sidan jag länkar till längst ner (källa) finns koden för CSharp om nån vill ha den. Det finns även ett par kommentarer som tar upp frågor om koden som kan vara bra att läsa. (Cache-version av sidan).

VB.net kod:

Namespace ircclient
Class MainClass
Public Shared Sub Main(args As String())
Dim port As Integer
Dim buf As String, nick As String, owner As String, server As String, chan As String
Dim sock As New System.Net.Sockets.TcpClient()
Dim input As System.IO.TextReader
Dim output As System.IO.TextWriter

'Get nick, owner, server, port, and channel from user
Console.Write("Enter bot nick: ")
nick = Console.ReadLine()
Console.Write("Enter bot owner name: ")
owner = Console.ReadLine()
Console.Write("Enter server name: ")
server = Console.ReadLine()
Console.Write("Enter port number: ")
port = Convert.ToInt32(Console.ReadLine())
Console.Write("Channel: ")
chan = Console.ReadLine()

'Connect to irc server and get input and output text streams from TcpClient.
sock.Connect(server, port)
If Not sock.Connected Then
Console.WriteLine("Failed to connect!")
Return
End If
input = New System.IO.StreamReader(sock.GetStream())
output = New System.IO.StreamWriter(sock.GetStream())

'Starting USER and NICK login commands
output.Write("USER " & nick & " 0 * :" & owner & vbCr & vbLf & "NICK " & nick & vbCr & vbLf)
output.Flush()

'Process each line received from irc server
buf = input.ReadLine()
While True

'Display received irc message
Console.WriteLine(buf)

'Send pong reply to any ping messages
If buf.StartsWith("PING ") Then
output.Write(buf.Replace("PING", "PONG") & vbCr & vbLf)
output.Flush()
End If
If buf(0) <> ":"C Then
Continue While
End If

' IRC commands come in one of these formats:
' * :NICK!USER@HOST COMMAND ARGS ... :DATA\r\n
' * :SERVER COMAND ARGS ... :DATA\r\n
'

'After server sends 001 command, we can set mode to bot and join a channel
If buf.Split(" "C)(1) = "001" Then
output.Write("MODE " & nick & " +B" & vbCr & vbLf & "JOIN " & chan & vbCr & vbLf)
output.Flush()
End If
buf = input.ReadLine()
End While
End Sub
End Class
End Namespace

Källa: https://jakash3.wordpress.com/2012/02/13/simple-vb-net-and-csharp-irc-client/