|
-
Jun 23rd, 2000, 02:22 AM
#1
Thread Starter
New Member
I want to make a chat... But How? Is there somewhere a Tutorial? Please help (chat-->SERVER... the clients connect to the server...)
-
Jun 23rd, 2000, 02:44 AM
#2
if you have VB pro or enterprise you can use the winsock OCX, else, you have to use the winsock API.
I kind of suck at winsock, so dont ask me HOW to make it
-
Jun 23rd, 2000, 02:57 AM
#3
I just sent you a tutorial on how you can make your own chat room in about 10 minutes. Hope it works.
-
Jun 23rd, 2000, 02:59 AM
#4
Thread Starter
New Member
-
Jun 23rd, 2000, 03:36 AM
#5
Lively Member
Matthew,
I would appresiate it if you sent me the same tutoriual.
(or if it could be forwarded to me by Wesley...)
Thanks.
Dan.
[email protected]
-
Jun 23rd, 2000, 05:25 AM
#6
Lively Member
Want to make an IRC client?
If you are trying to make an IRC(most popular chatting network) client, then i recommend you read the the text file that describe it's functionality. it's easy to understand. i only ready to get the strings should be send to the server and string will return though. The best way to make an IRC client is to create a simple program which have a connect and disconnect buttons, one text box for data that is received by winsock, textbox for data you type in and will be sent out.
If you want i can send you the program which have about this. only connect to local host though. you must have an irc-server running on your system.
i've found this is the best way to work around about writing a chat client. have a server, make a winsock program which will capture all data receive and put in a textbox, and an original chat client(to do the commands) and you will be able to figure out the rest.
-
Jun 23rd, 2000, 05:55 AM
#7
Lively Member
Chat
I would also like the tutorial so I can make a text adventure game and play with/against other people, could that be done.
-
Jun 23rd, 2000, 09:27 AM
#8
[/code]
Name: Make your own chat room in 10 minutes!
Description: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
By: Chaz
Inputs:None
Returns:None
Assumes:There are alot of things to set up in order for this code to work correctly. Here are the complete list of things you will need to do:
1. Add the mswinsck.ocx to your project
2. Create a textbox and name it txtHost This will be the box where the remote host is entered
3. Create a textbox and name it txtLocalP.This will be the box where the local port is entered
4. Create a textbox and name it txtRemotePThis will be the box where the remote port is entered
5. Create a textbox and name it txtNick This will be the box you will enter your nickname (aka screenname)
6. Create a textbox and name it txtSend This will be the box you type in to send stuff to the chatroom
7. Create a large textbox and name it txtMainThis will be the chatroom
8. Make txtMain multiline and also add vertical scrollbars
9. Create a command button and name it cmdC. Give it the caption "Connect"
10. Create a command button and name it cmdD. Give it the caption "Disconnect"
11. Create a command button and name it cmdSend. Give it the caption "Send".
This will be the button that sends the text in txtSend to the chatroom.
12. Put a winsock control on the form and name it sckSend
13. Labels can be put so you can remember which text box is which. Also, it would be best to erase all the text in the text boxes (ie: Get rid of Text1 written in the box)
When 2 people have the program running, this is how you connect:
1. First, enter a nickname in the txtNick box. This is the name that will come before what you say in the chatroom.
2. In the txtHost textbox, you must put the other person's IP address or hostname.
3. You and the other person must both think up any number to be your local port (Just make sure they're different numbers. ie: My local port is 1000, my friend's local port is 2000)
4. After you've both made up your local host and entered it in the txtLocalP textbox, you must next enter the other person's local port in your txtRemoteP textbox. For example, My local port is 1000. and my remote port is 2000... My friend's local port would be 2000 and my friends's remote port would be 1000.
5. Both of you must now click the connect button.
7. Now just type text in the txtSend textbox and click the "Send" button. You will notice the text moved into the chatroom. This text is visible by both people! Congratulations!
Side Effects:None
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
[/code]
This is a small tutorial on how tutorial on how to make your own winsock chat room. Don't ask questions, I have not experimented with this yet. I did not make it..just found it.
Enjoy!
-
Jun 23rd, 2000, 10:22 AM
#9
Junior Member
Thank you Help File
I learned TCP / IP solely through the VB help topics, and I think that was MORE than enough for chat, MUSHes, or anything in that grouping.
-
Jun 23rd, 2000, 03:20 PM
#10
Thread Starter
New Member
:-)
But How I Can Make The WinSoCK (or - something like that- ?)
I'm beginning in Visual Basic 5 Learning Edition
-
Jun 23rd, 2000, 03:22 PM
#11
Junior Member
VB 5, huh?
Well, I am not familiar with 5 as I went from 4 to 6, but I believe if you right click on the toolbar and select components, you should be able to add Microsoft Winsock Control to your toolbar. VB help will teach you the rest.
-
Jun 23rd, 2000, 09:13 PM
#12
Lively Member
To Create/add winsock control
on the right hand side of vb5 is a controls bar, right click it and choose components, then scroll down to microsoft winsock control and check it. click ok and you are done. now you can add winsock control into your project. kinda cool!!!
-
Jun 23rd, 2000, 10:06 PM
#13
he's got learning edit. that means he cant use winsock, you msut have pro or enterprise to use winsock. which sucks 
-
Jun 23rd, 2000, 10:13 PM
#14
Thread Starter
New Member
I'd like to do some things on ICQ with a "DUTCH" one.. I have visual basic 5 learning edition, and there is no winsock, i haven't found... so... Somebody?
My ICQ: #54312379
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|