|
-
Aug 25th, 2005, 03:15 AM
#1
Thread Starter
New Member
[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:
Private Sub sendupdate(ByRef strType As String, Optional length As Integer)
Dim i As Integer
Dim strUpd As String
if SERVER then
Select Case strType
Case "CHAT":
strUpd = "update:chat:" & Right(txtChatBox.Text, length)
Case "PLAYER":
strUpd = "update:player:" & txtCardName.Text
Case "BID":
strUpd = "update:bid:" & lblBidValue.Caption & ":" & txtFantasyTeam(6).Text
Case "NEXT":
strUpd = "update:next:" & txtFantasyTeam(5).Text
Case "LAST":
strUpd = "update:last:" & txtFantasyTeam(0).Text & ":" & txtPastPicksPlayer(0).Text
End Select
'On Error Resume Next
Dim tmr As Single
For i = 0 To sckIn.Count - 1
If sckIn(i).State = 7 Then
sckIn(i).SendData strUpd
Debug.Print sckIn(i).Tag & "'s " & strType & " Update sent"
End If
Next i
End If
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...
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
|