|
-
Aug 28th, 2006, 01:38 PM
#1
Thread Starter
Fanatic Member
[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 3 ops! 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:
Private Sub wsChat_Connect()
Do
DoEvents
Loop Until wsChat.State = sckConnected Or wsChat.State = sckError
If wsChat.State = sckConnected Then
'Tell the user that the connection has been established
AddText "----- Connection Established -----" & vbCrLf, txtIn
lblStatus.Caption = "Connected"
cmdSend.Enabled = True
cmdSendFile.Enabled = True
'txtName.Enabled = False
txtOut.SetFocus
cmdSend.Default = True
Else
'Tell the user that the connection has been established
AddText "----- Connection Failed -----" & vbCrLf, txtIn
lblStatus.Caption = "Connection Failed"
End If
End Sub
Private Sub wschat_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)
If Number <> 0 Then
AddText "----- Error [" & Description & "] -----" & vbCrLf, txtIn
Call cmdClose_Click
End If
End Sub
Private Sub cmdClose_Click()
'Disable the outgoing buttons and tell the user that the connection has been closed
wsChat.Close
cmdClose.Enabled = False
cmdSend.Enabled = False
'''txtName.Enabled = True
connect.Enabled = True
disconnect.Enabled = False
txtIn.text = "----- Connection Closed -----" & vbCrLf
End Sub
Last edited by kregg; Aug 28th, 2006 at 02:04 PM.
-
Aug 28th, 2006, 03:49 PM
#2
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
-
Aug 31st, 2006, 09:10 AM
#3
Thread Starter
Fanatic Member
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.
-
Aug 31st, 2006, 04:26 PM
#4
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
-
Sep 1st, 2006, 09:09 AM
#5
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|