here is the source you fixed how ever it has small error kindly help fix this sir please.
i run the server and i opened up 3 clients and had them all logged in when ever i log out the 1st chat client that logged in 1st then it gives this error in this line
and i tried fixing this by removing
this gives another problem when i change rooms number keeps increases in roomlist in server
if i just remove
then room numbers gets incriminats ++ up when logged out and when changing room please help fix
you the person you made me mod and i am sure this isnt gona be tuff for u, you can do this with eyes closed:(please doogle:(:(:(:(:( without your help i can finish my work:(
i run the server and i opened up 3 clients and had them all logged in when ever i log out the 1st chat client that logged in 1st then it gives this error in this line
Code:
Private Function GetAvailableSocketIndex() As Integer
Dim AvailIndex As Integer
Dim SocketElement As Variant
AvailIndex = 0
' First check for available sockets
For Each SocketElement In AcceptedSocket
If AcceptedSocket(SocketElement.Index).State = sckClosed Then
If SocketElement.Index <> 0 Then AvailIndex = SocketElement.Index
End If
Next SocketElement
' Next, if AvailIndex is 0 at this point, then we either don't have a created
' winsock that is closed, or we only have the original winsock, which we don't
' want to use. Therefore, we need to create a winsock and pass out it's index.
If AvailIndex = 0 Then
AvailIndex = AcceptedSocket.Count
Load AcceptedSocket(AvailIndex) <<<<<<<< here , gives object already loaded
End If
GetAvailableSocketIndex = AvailIndex
End Function
and i tried fixing this by removing
Code:
Public Sub AcceptedSocket_Close(Index As Integer)
'What to do when a client disconnects
Dim ChatRoomName As String
'Go ahead and close the socket, if not done already
'Not sure if this is necessary, but what the hay.
AcceptedSocket(Index).Close
'Get the appropriate user's chat room
ChatRoomName = Users(Str(Index)).ChatRoom
AdjustUserCount ChatRoomName, vbNullString, True
'Destroy the invalid user!
Users.Remove Str(Index)
'Get rid of the Winsock OCX instance
If Not Index = 0 Then Unload AcceptedSocket(Index) <<<<<< this line i removed and replaced
If Not Index = 0 Then AcceptedSocket(Index).Close
'Tell everyone in the defunct user's chat room (subtly)
'that they have been downsized
NotifyUpdateUserList ChatRoomName
'Update our own list of connected users.
UpdateConnUsersList
End Sub
if i just remove
Code:
If Not Index = 0 Then Unload AcceptedSocket(Index)
you the person you made me mod and i am sure this isnt gona be tuff for u, you can do this with eyes closed:(please doogle:(:(:(:(:( without your help i can finish my work:(