Recent Posts
None | 8 sec ago
None | 9 sec ago
None | 13 sec ago
Lua | 14 sec ago
C# | 32 sec ago
None | 41 sec ago
None | 42 sec ago
VB.NET | 1 min ago
None | 2 min ago
None | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By xdemo on the 4th of Jul 2009 06:32:38 AM Download | Raw | Embed | Report
  1. '<==Begin==>
  2.  
  3. 'Import libraries/system classes
  4. Imports System.Net.Sockets
  5. Imports System.Text
  6.  
  7. Public Class Form1
  8.     'reminder test server is lunar.nl.eu.SwiftIRC.net
  9.  
  10.     'declare client
  11.     Inherits System.Windows.Forms.Form
  12.     Private client As TcpClient
  13.  
  14.     'Connect Button
  15.     Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
  16.  
  17.         client = New TcpClient(txtServer.Text, txtPort.Text) 'open tcp socket to server + port
  18.         SendData("USER VBIRC VBIRC VBIRC Using VBIRC v0.1 http://xdemo.net") 'ident/realname/email etc
  19.         SendData("NICK " + txtNick.Text) 'use selected nickname
  20.  
  21.         'enable required controls,
  22.         cmdDisconnect.Enabled = True
  23.         cmdJoin.Enabled = True
  24.         cmdPart.Enabled = True
  25.         cmdSend.Enabled = True
  26.         cmdNick.Enabled = True
  27.  
  28.         'disable un-needed controls
  29.         txtServer.Enabled = False
  30.         cmdConnect.Enabled = False
  31.  
  32.         'initiate timer to reply for pings.
  33.         tmrPONG.Enabled = True
  34.  
  35.     End Sub
  36.  
  37.     'Timer to ping/pong
  38.     Private Sub tmrPONG_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrPONG.Tick
  39.         SendData("PONG :" + txtServer.Text) 'reply to "PINGS" every 3minutes once connected
  40.     End Sub
  41.  
  42.     'Declare senddata
  43.     Private Sub SendData(ByVal data As String)
  44.         Dim writer As New IO.StreamWriter(client.GetStream)
  45.         writer.Write(data & vbCr)
  46.         writer.Flush()
  47.     End Sub
  48.  
  49.     'Send message button
  50.     Private Sub cmdSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSend.Click
  51.  
  52.         SendData("PRIVMSG " + txtChannel.Text + " " + txtInput.Text)
  53.  
  54.     End Sub
  55.  
  56.     'Change nick button
  57.     Private Sub cmdNick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNick.Click
  58.  
  59.         SendData("NICK " + txtNick.Text)
  60.  
  61.     End Sub
  62.  
  63.     'Join channel button
  64.     Private Sub cmdJoin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdJoin.Click
  65.  
  66.         SendData("JOIN " + txtChannel.Text)
  67.  
  68.     End Sub
  69.  
  70.     'part channel button
  71.     Private Sub cmdPart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPart.Click
  72.  
  73.         SendData("PART " + txtChannel.Text + " " + txtPartReason.Text)
  74.  
  75.     End Sub
  76.  
  77.     'Quit/Disconnect button
  78.     Private Sub cmdDisconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDisconnect.Click
  79.  
  80.         SendData("QUIT VBIRC v0.1 created by xdemo.") 'send raw quit to server and show quit message
  81.  
  82.         'disable pong timer, since we are not connected
  83.         tmrPONG.Enabled = False
  84.  
  85.         'disable un-needed controls
  86.         cmdDisconnect.Enabled = False
  87.         cmdJoin.Enabled = False
  88.         cmdPart.Enabled = False
  89.         cmdSend.Enabled = False
  90.         cmdNick.Enabled = False
  91.  
  92.         'enable required controls again
  93.         txtServer.Enabled = True
  94.         cmdConnect.Enabled = True
  95.     End Sub
  96. End Class
  97. '<==END==>
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: