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