Results 1 to 2 of 2

Thread: [RESOLVED] Fantasy Football program problems...

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    2

    Resolved [RESOLVED] Fantasy Football program problems...

    Hey all...

    Having an issue with a program I am writing. The program is essentially a communication medium for us on draft day with several Fantasy Owners connecting to a server to chat/bid. The application takes bids, posts them on its monitor, provides chat... etc...

    The problem is that only the last client connected to the server gets any updates.

    The connections breakdown like this.
    1) Client's sckMain (a Winsock control) connects to the server on port 80.
    2) Client sends "team:XXX"
    3) Server finds an available Winsock control from arSckIn (an control array of Winsock controls) - if none are available it creates a new one (load arSckIn(arSckIn.count)) where arSckIn is the array of Winsock controls
    4) Server sends back "connect:(portnumber)" to the client
    5) Server closes its connection to the client and opens the other WinSock to listen for client attempting to connect
    6) Client Receives "connect:(portnumber)" and closes main winsock control
    7) Client changes remoteport of sckMain to the port received from the server
    8) Client connects on the port

    At this point everything is happy.
    The server sends out an update saying "The Angry Bunnies have connected"- or whatever the team connected as - and it appears on the server-side and client-side.

    The problem occurs after a second user connects. When he/she connects they receive "The Hot Dogs have connected" and everything appears good. They can chat just fine. The Angry Bunnies (first connection) can chat and their messages appear on the Hot Dog's (2nd connection), and the servers screen. However, no updates are received by the Angry Bunnies ever again. They can't see the Dog's chat, their own chat... nuthin...

    The lack of updates includes anything sent out arSckIn() except for the last person to connect. It goes for server commands (like changing the player up for bid), chat, everything.

    However, I did find if I follow these steps, updates appear:
    1. Send a chat from anyone
    2. Pause the server (the pause button in VB6's IDE)
    3. Run the server (the run button in VB6's IDE)

    Suddenly the chat will appear in the Angry Bunnies' window!

    It gets weirder... If multiple updates are sent from someone, then I pause and unpause the server... ALL the updates come through to the Bunnies at once. This leads to a great amount of confusion by the client program because it is just straight text. Updates come through as:
    "update:chat:THIS IS A CHAT" or "update:player:Peyton Manning"
    So if I send a chat from the Dog's, then update the player from the Dog's, pause-unpause, the following appears in the Bunnies' chat window:
    "The Hot Dogs: THIS IS A CHAT
    update:player:Peyton Manning"
    While the Dog's looks just fine, changing the various other portions of the interface to reflect the changed player, and only adding "THIS IS A CHAT" in the chat window.

    Lastly, if I set a stop point on the Angry Bunnies' DataArrival method, the server sends the update, but the stop point is never triggered!

    If anyone has any idea why this might be occurring, your input would be GREATLY appreciated, as draft day is Sunday and I'd like to use this program THIS year... =)

    The code to update clients is listed below:

    VB Code:
    1. Private Sub sendupdate(ByRef strType As String, Optional length As Integer)
    2.  
    3. Dim i As Integer
    4. Dim strUpd As String
    5. if SERVER then
    6.   Select Case strType
    7.       Case "CHAT":
    8.           strUpd = "update:chat:" & Right(txtChatBox.Text, length)
    9.       Case "PLAYER":
    10.           strUpd = "update:player:" & txtCardName.Text
    11.       Case "BID":
    12.           strUpd = "update:bid:" & lblBidValue.Caption & ":" & txtFantasyTeam(6).Text
    13.       Case "NEXT":
    14.           strUpd = "update:next:" & txtFantasyTeam(5).Text
    15.       Case "LAST":
    16.           strUpd = "update:last:" & txtFantasyTeam(0).Text & ":" & txtPastPicksPlayer(0).Text
    17.   End Select
    18.  
    19. 'On Error Resume Next
    20.   Dim tmr As Single
    21.   For i = 0 To sckIn.Count - 1
    22.       If sckIn(i).State = 7 Then
    23.           sckIn(i).SendData strUpd
    24.           Debug.Print sckIn(i).Tag & "'s " & strType & " Update sent"
    25.       End If
    26.   Next i
    27. End If
    28. End Sub

    *note the resume next is commented out because I was WANTING the program to error, just so that I might be able to see a problem... But nuthin...

  2. #2

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    2

    Re: Fantasy Football program problems...

    Yeesh.... All that typing and I found an answer within 20 minutes...

    I added a "DoEvents" right below the SendData and it fixed it...

    Meh... Such is VB6...

    -Coach

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