Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21842

doogle need your help

$
0
0
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

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

this gives another problem when i change rooms number keeps increases in roomlist in server

if i just remove
Code:

If Not Index = 0 Then Unload AcceptedSocket(Index)
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:(
Attached Files

Viewing all articles
Browse latest Browse all 21842

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>