Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Zlip mixed with IOCP+PackerBuffer
#1
So, I can't seem to get ZLip working correctly serverside. Client side was easy. You see after installing IOCP and the packet buffer to it, I wanted to try Zlip. But the packetbuffer sub SendQueuedData had to be changed in order to work with IOCP (thanks Obsidian).

So here is my SendQueuedData sub with IOCP and the packet buffer added:
Code:
Sub SendQueuedData()
Dim i As Integer, n As Long
Dim TmpStr As String
Dim dbytes() As Byte
Dim Sploc As Integer
Dim ECloc As Integer
Dim lR As Long

    For i = 1 To MAX_PLAYERS
      TmpStr = ""
      With ConQueues(i)
        If Not .Lock Then
            On Error Resume Next
            If GameServer.Sockets(i).Socket Is Nothing Then
                .Lines = ""
            End If
            If Len(.Lines) = 0 And QueueDisconnect(i) = True Then
                Call CloseSocket(i)
                QueueDisconnect(i) = False
            Else
            If Len(.Lines) > 0 Then
               If Len(.Lines) < MAX_PACKETLEN Then
                 TmpStr = .Lines
               Else
                 TmpStr = Left(.Lines, MAX_PACKETLEN)
               End If
               .Lines = Right(.Lines, Len(.Lines) - Len(TmpStr))
            End If
          End If
          If Len(TmpStr) > 0 Then
            dbytes = StrConv(TmpStr, vbFromUnicode)
            If IsConnected(i) Then
                'Call EnigmaEncrypt(dbytes, "travis")
                GameServer.Sockets(i).WriteBytes dbytes
                DoEvents
            End If
          End If
        End If
      End With
    Next
    DoEvents
End Sub
This is what Zlib want me to replace it with:
Code:
Sub SendQueuedData()
Dim ECloc As Integer
Dim lR As Long

  Dim i As Integer, N As Long
  Dim TmpStr As String

  For i = 1 To MAX_PLAYERS
    If frmServer.lblOnOff.Caption = "OFFLINE" Then Exit Sub
    TmpStr = ""
    With ConQueues(i)
      If Not .Lock Then
        If frmServer.Socket(i).State  7 Then
          .Lines = ""
        End If
        If Len(.Lines) = 0 And QueueDisconnect(i) = True Then
          Call CloseSocket(i)
          QueueDisconnect(i) = False
        Else
          If Len(.Lines) > 0 Then
             If Len(.Lines) < MAX_PACKETLEN Then
               TmpStr = .Lines
             Else
               TmpStr = Left(.Lines, MAX_PACKETLEN)
             End If
             ECloc = InStr(1, .Lines, END_CHAR)
             TmpStr = Left(.Lines, ECloc)
             .Lines = Right(.Lines, Len(.Lines) - Len(TmpStr))
          End If
        End If
        If Len(TmpStr) > 0 Then
             Debug.Print "Sending: " & TmpStr
             TmpStr = Compress(TmpStr, lR)
             TmpStr = lR & SEP_CHAR & TmpStr
             Call frmServer.Socket(i).SendData(TmpStr)
        End If
      End If
    End With
    DoEvents
  Next
End Sub
If you look close, you will se some differences between them. And I need to know how to make Zlib work with IOCP and the packetbuffer.So somehow they should be mixed together. THis is out of my knowledge so I need some help.

Related Topics
Zlib: http://ms.shannaracorp.com/backup-forum ... sp?TID=218
PacketBuffer: http://ms.shannaracorp.com/backup-forum ... sp?TID=224
IOCP: http://ms.shannaracorp.com/backup-forum ... sp?TID=120
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)