01-01-2007, 09:34 PM
Difficulty: 1/5
Introduction
You should only make this change if you have IOCP.
Step 1, complete this tutorial:
http://www.key2heaven.net/ms/forums/viewtopic.php?t=894
Step 2, replace the whole sub:
With this:
That should make the packet buffer work for IOCP as well.
Introduction
You should only make this change if you have IOCP.
Step 1, complete this tutorial:
http://www.key2heaven.net/ms/forums/viewtopic.php?t=894
Step 2, replace the whole sub:
Code:
Sub SendQueuedData()
Dim i As Integer, n As Long
Dim TmpStr As String
For i = 1 To MAX_PLAYERS
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
.Lines = Right(.Lines, Len(.Lines) - Len(TmpStr))
End If
End If
If Len(TmpStr) > 0 Then
Call frmServer.Socket(i).SendData(TmpStr)
End If
End If
End With
Next
DoEvents
End Sub
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 = vbNullString
With ConQueues(i)
If Not .Lock Then
On Error Resume Next
If GameServer.Sockets(i).Socket Is Nothing Then
.Lines = vbNullString
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
GameServer.Sockets(i).WriteBytes dbytes
DoEvents
End If
End If
End If
End With
Next
DoEvents
End Sub
That should make the packet buffer work for IOCP as well.