| Mirage Source http://www.miragesource.net/forums/ |
|
| Packetbuffer for IOCP http://www.miragesource.net/forums/viewtopic.php?f=210&t=1016 |
Page 1 of 1 |
| Author: | William [ Mon Jan 01, 2007 9:34 pm ] |
| Post subject: | Packetbuffer for IOCP |
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: 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 With this: 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. |
|
| Author: | Krloz [ Mon Jan 08, 2007 4:38 am ] |
| Post subject: | |
thanks |
|
| Author: | TheRealDamien [ Mon Jan 08, 2007 9:49 am ] |
| Post subject: | |
Uhh to add this tut - http://www.key2heaven.net/ms/forums/viewtopic.php?t=894 you dont need to have ICOP... I recommend you make that clear to everyone because your post was very unclear about that. |
|
| Author: | William [ Mon Jan 08, 2007 11:07 am ] |
| Post subject: | |
Damien, don't get me doubting my knowledge when Im correct. You see this was added with IOCP: Code: Public Sub WriteBytes(dbytes() As Byte, Optional thenShutdown As Boolean) Call mvarSocket.Write(dbytes, thenShutdown) End Sub And for example, the packet buffer had this in the original tutorial: Code: If Len(TmpStr) > 0 Then Call frmServer.Socket(i).SendData(TmpStr) End If And the new has to look like this: Code: If Len(TmpStr) > 0 Then
dbytes = StrConv(TmpStr, vbFromUnicode) If IsConnected(i) Then GameServer.Sockets(i).WriteBytes dbytes DoEvents End If End If You see how it uses the '.WriteBytes'. I believe a few other things had to be changed as well. And also, I helped another person with that code for this IOCP with the packet buffer, and that worked fine for me too. My former Topic concerning this: http://www.key2heaven.net/ms/forums/vie ... 401aa29e01 |
|
| Author: | Obsidian [ Wed Jan 10, 2007 6:13 pm ] |
| Post subject: | |
Please read before posting any comments that may be taken as 'flame-bait', and please, if you have the urge to flame someone, PM them and try to keep the forum clean... it really doesn't make anyone look good, or better than the person they decide to flame. It is pointless and annoying for everyone. That is all. |
|
| Author: | Xlithan [ Thu Mar 08, 2007 7:50 pm ] |
| Post subject: | |
Works great, thanks. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|