Results 1 to 11 of 11

Thread: [RESOLVED] Help with VB6 Network coding! Doesn't go in correct order!

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    62

    Re: Help with VB6 Network coding! Doesn't go in correct order!

    VB Code:
    1. Public Sub Ostats(ByVal Index As Integer)
    2.     If frmServer.WStcpServer(Index).State <> sckClosed Then
    3.         MsgSend = "~g" & "Welcome to Future Galaxy! There are ~w" & usersonline & "~g users connected and a total of ~w" & userstotal & "~g connections today."
    4.         blnRetVal = WinsockSend(frmServer.WStcpServer(Index), MsgSend)
    5.     End If
    6. End Sub
    7.  
    8. 'Load character room for the first time
    9. Public Sub CharacterWelcome(ByVal Index As Integer)
    10.     Dim i As Integer
    11.    
    12.     If Not rsuserdata.EOF Then rsuserdata.MoveFirst ' make sure your on the first one
    13.     rsuserdata.FindFirst "Character='" & users(Index) & "'" 'Find the username
    14.     userroom(Index) = roomidnumber(userroom(Index)) 'Room Number
    15.     Call Ostats(Index)
    16.    
    17.     'If joining the game say this
    18.     For i = frmServer.WStcpServer.LBound + 1 To frmServer.WStcpServer.UBound
    19.     If frmServer.WStcpServer(i).State <> sckClosed Then
    20.         If userroom(i) = userroom(Index) Then 'In the room
    21.             If Not users(i) = users(Index) Then 'User typed
    22.                 MsgSend = "~g" & users(Index) & " has just entered the game!"
    23.                 blnRetVal = WinsockSend(frmServer.WStcpServer(i), MsgSend)
    24.             End If
    25.         End If
    26.     End If
    27.     Next
    28.    
    29.     Call CheckRoom(Index)
    30.     Call CharacterRoomA(Index)
    31. End Sub

    Generally the CharacterWelcome goes first. It will call ostats though. Generally CaracaterRoomA is where it sends more data, it sends this after getting some quick data:
    VB Code:
    1. If firstchar = 1 Then
    2.             If frmServer.WStcpServer(Index).State <> sckClosed Then
    3.                 MsgSend = "¿csdl¶" & Sidelist
    4.                 blnRetVal = WinsockSend(frmServer.WStcpServer(Index), MsgSend)
    5.                 MsgSend = "~w<~g" & roomtitle(userroom(Index)) & "~w> " & roomdescription(userroom(Index)) & " " & Charsinroom & " is here with you. There is a " & LCase(itemsinroom) & " here."
    6.                 blnRetVal = WinsockSend(frmServer.WStcpServer(Index), MsgSend)
    7.             End If

    What happens there is it sends the room data right after the Ostats to the player that joins.

    Oh, and WinsockSend is how it sends it:

    VB Code:
    1. Public Function WinsockSend(pSock As Winsock, ByVal Data As String) As Boolean
    2.   ' send the data on the passed winsock
    3.   If pSock.State = sckConnected Then
    4.     ' send the data and return true
    5.     pSock.SendData Data & packetDelimiter
    6.     DoEvents
    7.     WinsockSend = True
    8.   Else
    9.     ' return false because we're not connected
    10.     WinsockSend = False
    11.   End If
    12. End Function

    The packetdelim is 'packetDelimiter = Chr$(0)'

    ---

    This is what it looks like in a text box (SAMPLE) on connect:

    Welcome to Future Galaxy! There are 1 users connected and a total of 1 connections today.
    <Dark Room> You are in a dark room. You can see faint light coming from a door to the south.

    But sometimes it will do this, this is for any data, but this is a sample. Again this would be on connect.

    <Dark Room> You are in a dark room. You can see faint light coming from a door to the south.
    Welcome to Future Galaxy! There are 1 users connected and a total of 1 connections today.

    As you see it will basicly jump around depending if it was sent to quickly. I don't lose any data, but it seems like its placing the last data recieved on first if two data are send together quickly.

    P.S. Ignore the ~w, ~g, etc. Those are for color sending.

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    62

    Re: Help with VB6 Network coding! Doesn't go in correct order!

    This happens with any coding, but thats a sample. Generally whats happening is if two coding is sent out at the same time, the last one is displayed first. It should display the FIRST one always and go down the list.

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