Advertisement
ASP_Volume3 Internet/ HTML #44556

Make your own chat room in 10 minutes!

Ever want your own chat? Ever want your own rules? This code allows you to make your own chat room! Allows 2 people to chat from anywhere in the world from any internet provider! Perfect for quick and private communication! NOTE: This program requires mswinsck.ocx

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Private Sub cmdC_Click()
   If Len(txtNick) < 1 Then 'make sure there is a nickname entered
     MsgBox "You must enter a nickname first!"
     txtNick.SetFocus 'put the cursor in the nickname textbox
     Exit Sub
   End If
   
   If Len(txtHost) < 1 Or Len(txtLocalP) < 1 Or Len(txtRemoteP) < 1 Then
    MsgBox "Please make sure a Host, a Local Port, and a Remote Port have been entered!"
    Exit Sub
   End If
   sckSend.RemoteHost = txtHost   'set the host
   sckSend.LocalPort = txtLocalP   'set the local port
   sckSend.RemotePort = txtRemoteP  'set the remote port
   sckSend.Bind 'Connect!
   cmdSend.Enabled = True 'Enable the send button
   txtNick.Enabled = False 'Make it so you can't change your nickname
   txtSend.SetFocus   'you have been connected. put the cursor in the send textbox
End Sub
Private Sub cmdD_Click()
'The disconnect button was pushed.
End
End Sub
Private Sub cmdSend_Click()
'The Send button was pushed
sckSend.SendData txtNick.Text & ": " & txtSend.Text & Chr$(13) & Chr$(10) 'Send whatever is wrtten in txtSend to the other person's chatroom.
txtMain.Text = txtMain.Text & txtNick.Text & ": " & txtSend.Text & Chr$(13) & Chr$(10) 'Put it in your chatroom
txtMain.SelStart = Len(txtMain) 'scroll that chatroom down
txtSend.Text = "" 'clear the send textbox
End Sub
Private Sub Form_Load()
sckSend.Protocol = sckUDPProtocol 'set protocol. For this type of chat, we are using UDP
cmdSend.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub sckSend_DataArrival(ByVal bytesTotal As Long)
'We have received data!
Dim TheData As String
On Error GoTo ClearChat
sckSend.GetData TheData, vbString 'extract the data
txtMain.Text = txtMain.Text & TheData 'add the data to our chatroom
txtMain.SelStart = Len(txtMain) 'scroll that chatroom down
Exit Sub
ClearChat:
MsgBox "Chat room ran out of memory and must be cleared!"
txtMain.Text = ""
End Sub
Private Sub sckSend_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "An error occurred in winsock!"
End
End Sub

Upload
Upload
Upload
Original Comments (3)
Recovered from Wayback Machine