Results 1 to 14 of 14

Thread: Chat

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    4

    Talking

    I want to make a chat... But How? Is there somewhere a Tutorial? Please help (chat-->SERVER... the clients connect to the server...)

  2. #2
    Guest
    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

  3. #3
    Guest
    I just sent you a tutorial on how you can make your own chat room in about 10 minutes. Hope it works.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    4
    Tnx...

  5. #5
    Lively Member
    Join Date
    Sep 1999
    Location
    u.s.a
    Posts
    127
    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]


  6. #6
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    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.
    ngphuocthinh

  7. #7
    Lively Member
    Join Date
    Jun 2000
    Location
    FL
    Posts
    76

    Post 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.

  8. #8
    Guest

    Post

    [/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!

  9. #9
    Junior Member
    Join Date
    Mar 2000
    Location
    Omaha, NE, USA
    Posts
    28

    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.
    - Ovid -

  10. #10

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    4
    :-)
    But How I Can Make The WinSoCK (or - something like that- ?)
    I'm beginning in Visual Basic 5 Learning Edition

  11. #11
    Junior Member
    Join Date
    Mar 2000
    Location
    Omaha, NE, USA
    Posts
    28

    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.
    - Ovid -

  12. #12
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    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!!!
    ngphuocthinh

  13. #13
    Guest
    he's got learning edit. that means he cant use winsock, you msut have pro or enterprise to use winsock. which sucks


  14. #14

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    4
    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
  •  



Click Here to Expand Forum to Full Width