Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disable Nagling
#1
Introcution
When adding Verrigans packet buffer to your game: viewtopic.php?f=69&t=894
You will have 2 buffers working on the game, since winsock has it's own inbuilt packet buffer called nagling. Each taking around 100ms-200ms I believe, now we want to get rid of the nagling buffer and only have the buffer constructed for ms games.

And in case you add the buffer now, and already have IOCP, you need to go through my other tutorial to make it work for IOCP: viewtopic.php?f=69&t=1016

Do not turn of nagling without having the packet buffer added!

Client Side
Find this:
Code:
With frmMirage.Socket
        .Close
        .Connect
    End With
Under that, add:
Code:
Call setsockopt(frmMirage.Socket.SocketHandle, IPPROTO_TCP, TCP_NODELAY, 1, 4)
Now, in any of your modules, add:
Code:
Public Const TCP_NODELAY = &H1&
Public Const IPPROTO_TCP = 6
Public Declare Function setsockopt Lib "WSOCK32.DLL" (ByVal s As Long, ByVal Level As Long, ByVal optname As Long, optval As Any, ByVal optlen As Long) As Long

And that should be it! This will probably decrease your ping a little.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)