VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Vary Simple IRC Client

by Ryan Roy (1 Submission)
Category: Internet/HTML
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

A Vart Simple And Basic IRC Client To Help Beginners To Connect To A IRC Server. It Will Just Connect And Get Data. It Has Ident And Ping Reply.

Assumes
Add 2-Buttons 1-richtextbox 2-winsocks (1 named wsMain and 1 names wsIDENT) and 1-timmer(interval set to 10) Then Copy And Paste All The Code
API Declarations
Dim IdentName As String

Rate Vary Simple IRC Client

Private Sub Command1_Click()
'This Connects To The IRC Server And THe Port To Use
  wsMain.Connect "oslo.no.eu.undernet.org", 6667
End Sub
Private Sub Command2_Click()
'This Disconnects You From The Server
  wsMain.SendData "QUIT :Your Reason For Quiting"
  wsMain.Close 'Closes The Socket So Its Ready To Use Again
End Sub
Private Sub Form_Load()
'This Sets Your Ident Name And The Port To Listen On
  IdentName = "My_IDENT_Name" 'Your Ident Name
  wsIDENT.LocalPort = 113 'The Port To Listen On
  wsIDENT.Listen 'Tells Socket To Listen
End Sub
Private Sub Timer1_Timer()
'This Is The Timer For The Ident
  If wsIDENT.State <> 2 And wsIDENT.State <> 7 Then 'If Socket Is Not Listening Or Has A Open Connection
    wsIDENT.Close 'Closes The Socket
    wsIDENT.Listen 'Reset The Socket To Listen
  End If
End Sub
Private Sub wsIDENT_ConnectionRequest(ByVal requestID As Long)
'This Is For When The Server Trys To Get Your Ident
  wsIDENT.Close 'Closes The Socket
  wsIDENT.Accept requestID 'Accepts The Connection From The Server
  wsIDENT.SendData "113, 133:USERID:WIN32:" & IdentName 'Send Your Ident Info To The Server
End Sub
Private Sub wsMain_Connect()
'This Sends The Data You Need To Connect To A Server
  wsMain.SendData "User " & "[email protected]" & " " & wsMain.LocalHostName & " " & wsMain.RemoteHost & " :" & "Your Real Name" & vbCrLf
  wsMain.SendData "NICK " & "Your_Nick" & vbCrLf
End Sub
Private Sub wsMain_DataArrival(ByVal bytesTotal As Long)
'This Gets The Data From The Server And Puts It Into The TextBox
Dim Data As String
  wsMain.GetData Data 'Gets The Data
  
'This Sends The Pong Back To THe Server When U Get A Ping Msg
  If Left(Data, Len("PING")) = "PING" Then 'If The Data Has PING In It
    wsMain.SendData Replace(Data, "PING", "PONG") & vbCrLf 'Replaces The PING With A PONG And Sends The Rest Of THe Line Back To The Server
  End If
  
'This Puts All The Data In The TextBox So U Can Read It
  RichTextBox1.Text = RichTextBox1.Text & Data
End Sub

Download this snippet    Add to My Saved Code

Vary Simple IRC Client Comments

No comments have been posted about Vary Simple IRC Client. Why not be the first to post a comment about Vary Simple IRC Client.

Post your comment

Subject:
Message:
0/1000 characters