Results 1 to 3 of 3

Thread: advanced debug help needded [SOLVED]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2011
    Posts
    118

    advanced debug help needded [SOLVED]

    Hello,

    I'm trying to make an rpg game. Im setting up the client and server, but now i have a problem: the server can't accept more then 1 connection, then it says the server is offline. Also, after you closed the first connection, you can't re-connect to the server.

    Can someone please tell me what is wrong so i can change my source code?

    the project is below

    thanks in advanced,
    jimpie
    Attached Files Attached Files
    Last edited by jimpie; Jul 15th, 2011 at 03:00 AM. Reason: solved

  2. #2
    Addicted Member reacen's Avatar
    Join Date
    Jul 2009
    Location
    c:\windows\system32\gdi32.dll
    Posts
    243

    Re: advanced debug help needded

    Just change the AcceptConnection() function in your modDatabase to this:

    Code:
    Public Sub AcceptConnection(ByVal RequestID As Long)
    
        Dim i As Long
    
        i = FindOpenPlayerSlot
    
        If i <> 0 Then
            ' we can connect them
            frmServer.Socket(i).Close
            frmServer.Socket(i).Accept RequestID
            Call SocketConnected(i)
        End If
    
    End Sub
    And in your socket_ConnectionRequest() on the frmServer, make it like this:

    Code:
    Private Sub socket_ConnectionRequest(index As Integer, ByVal RequestID As Long)
    
        Call AcceptConnection(RequestID)
    
    End Sub
    It should work fine, It works for me.
    The problem was that you where closing the Socket(0) on your AcceptConnection() function.
    The Socket(0) should never be closed, since it's the socket that listen for all the others.
    DoEvents

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2011
    Posts
    118

    Re: advanced debug help needded

    thanks alot mate!!!

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