Results 1 to 5 of 5

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

  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.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: ChatIM Program wont connect properly via winsock

    Under what conditions is it not connecting? Both clients and the server in the same LAN? Different LANs? Are the clients connecting to the server and not to each other, or not even to the server?
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  3. #3

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

    Re: ChatIM Program wont connect properly via winsock

    well it's under the same computer, and different pcs. When it directly connects, it seems to have a problem and it never connects to the program listening.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: ChatIM Program wont connect properly via winsock

    It randomly connnects and doesn't connect when the server and client are on the same computer, and randomly connnects and doesn't connect when the server and client are on different computers in the same LAN?

    Exactly what happens under exactly which conditions is critical to debugging this problem. "Something like ..." isn't going to help me to help you.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  5. #5

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

    Re: ChatIM Program wont connect properly via winsock

    For some strange reason in which I cannot explain (I have done nothing to the project) it seems to work...

    Well, thanks for your help anyways Al42. Something must've been fishy with my firewall

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