Results 1 to 5 of 5

Thread: [RESOLVED] ChatIM Program wont connect properly via winsock

Threaded View

  1. #1

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Resolved [RESOLVED] ChatIM Program wont connect properly via winsock

    I have spent a long time trying to piece this problem together but I don't understand it.

    In simple terms, the problem is that the program will not connect properly to each other...

    Basically, what my program does is like a cut down version of msn - it asks for user ID and password, allows you to login, (and this is where it's not so msn) and then you can make the program listen out for any connections or you can just directly connect to them as long as you know their username.

    Since the code altogether is a lot of posts, I've just cut it down to just the source code and even the program itself (i think ).

    Can anyone help my problem? Thanks for any posts in advance!

    EDIT: Got rid of unnecessary file in attachment
    EDIT 2:Add some code from the zip file so it doesn't matter about downloading the zip. However, it's still available
    EDIT 3ops! sorry, forgot to mention that if you do download the zip file, there are 2 dummy usernames:
    login1: dummy password: name
    login2: false password: teeth
    The whole point of the username and password feature so the user remembers the login id, and not the IP address. Also, the login ID is specific to the IP Address.

    VB Code:
    1. Private Sub wsChat_Connect()
    2.     Do
    3.         DoEvents
    4.     Loop Until wsChat.State = sckConnected Or wsChat.State = sckError
    5.  
    6.     If wsChat.State = sckConnected Then
    7.         'Tell the user that the connection has been established
    8.         AddText "----- Connection Established -----" & vbCrLf, txtIn
    9.         lblStatus.Caption = "Connected"
    10.         cmdSend.Enabled = True
    11.         cmdSendFile.Enabled = True
    12.         'txtName.Enabled = False
    13.         txtOut.SetFocus
    14.         cmdSend.Default = True
    15.     Else
    16.         'Tell the user that the connection has been established
    17.         AddText "----- Connection Failed -----" & vbCrLf, txtIn
    18.         lblStatus.Caption = "Connection Failed"
    19.     End If
    20. End Sub
    21.  
    22. Private Sub wschat_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, _
    23. ByVal Source As String, ByVal HelpFile As String, -
    24. ByVal HelpContext As Long, CancelDisplay As Boolean)
    25.     If Number <> 0 Then
    26.         AddText "----- Error [" & Description & "] -----" & vbCrLf, txtIn
    27.         Call cmdClose_Click
    28.     End If
    29. End Sub
    30.  
    31. Private Sub cmdClose_Click()
    32. 'Disable the outgoing buttons and tell the user that the connection has been closed
    33.     wsChat.Close
    34.     cmdClose.Enabled = False
    35.     cmdSend.Enabled = False
    36.     '''txtName.Enabled = True
    37.     connect.Enabled = True
    38.     disconnect.Enabled = False
    39.     txtIn.text = "----- Connection Closed -----" & vbCrLf
    40. End Sub
    Last edited by kregg; Aug 28th, 2006 at 02:04 PM.

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