• Welcome to Valhalla Legends Archive.
 

High Latency and Invalid version?

Started by Jaquio, May 03, 2006, 05:09 PM

Previous topic - Next topic

l)ragon

Quote from: raylu on May 04, 2006, 06:22 PM
So why do you send them?
Easy way of seeing if your connected to the server still.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

Hero

Quote from: raylu on May 04, 2006, 06:22 PM
So why do you send them?
Well, If I want a really high ping I use:
                For X = 1 To 99999
                    .Send SID_NULL
                Next X

If I want a negative one, I just don't send any nulls.

Jaquio

Quote from: HeRo on May 04, 2006, 06:13 PM
Just try it, when I use it my ping is 30-50, when I dont use it, its about 300+.

When I tried it I had a latency of about 3k.. Lmao. It don't help me at all..

Quote from: HeRo on May 04, 2006, 10:13 PM
Quote from: raylu on May 04, 2006, 06:22 PM
So why do you send them?
Well, If I want a really high ping I use:
For X = 1 To 99999
.Send SID_NULL
Next X

If I want a negative one, I just don't send any nulls.

Lol,  yea as I stated before, if I just send a sid_null before anything it makes my latency higher..

As for someone else connecting with it, theirs wasn't that high, only 80ms.. So it's not my coding or anything I guess I should have tested that before I posted about it.. Well thanks again everyone sorry for the trouble will post back if I cannot fix the invalid version issue..

Hero

Try again, sometimes its high, but I'd say about 90% of the time it isn't.

Jaquio

I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)

topaz

Quote from: Jaquio on May 05, 2006, 12:43 AM
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)

SID_LEAVECHAT?!
RLY...?

MyndFyre

Quote from: Topaz on May 05, 2006, 01:27 AM
Quote from: Jaquio on May 05, 2006, 12:43 AM
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)

SID_LEAVECHAT?!

BNLS 0x10 BNLS_REQUESTVERSIONBYTE.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Jaquio

Quote from: Topaz on May 05, 2006, 01:27 AM
Quote from: Jaquio on May 05, 2006, 12:43 AM
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)

SID_LEAVECHAT?!
Quote from: MyndFyre[vL] on May 05, 2006, 02:09 AM
Quote from: Topaz on May 05, 2006, 01:27 AM
Quote from: Jaquio on May 05, 2006, 12:43 AM
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)

SID_LEAVECHAT?!

BNLS 0x10 BNLS_REQUESTVERSIONBYTE.

Err, yea sorry should have specified which protocol it was for sorry.  :-[

raylu

Wait...did I miss something? We're talking about some BNLS packet concerning products and Topaz starts talkingabout SID_LEAVECHAT?
Pie?

UserLoser

Quote from: HeRo on May 04, 2006, 10:13 PM
Quote from: raylu on May 04, 2006, 06:22 PM
So why do you send them?
Well, If I want a really high ping I use:
                For X = 1 To 99999
                    .Send SID_NULL
                Next X

If I want a negative one, I just don't send any nulls.

...Why don't you just Sleep() or something...?

topaz

Quote from: UserLoser on May 05, 2006, 11:18 PM
Quote from: HeRo on May 04, 2006, 10:13 PM
Quote from: raylu on May 04, 2006, 06:22 PM
So why do you send them?
Well, If I want a really high ping I use:
                For X = 1 To 99999
                    .Send SID_NULL
                Next X

If I want a negative one, I just don't send any nulls.

...Why don't you just Sleep() or something...?

You crash after a particularly high delay, I think.
RLY...?

Tazo

Credits to MSDN, forgot where I found it or I'd link you. Waits for X seconds without freezing your thread, like Sleep() does.


Option Explicit

Private Type FILETIME
    dwLowDateTime As Long
    dwHighDateTime As Long
End Type

Private Const WAIT_ABANDONED& = &H80&
Private Const WAIT_ABANDONED_0& = &H80&
Private Const WAIT_FAILED& = -1&
Private Const WAIT_IO_COMPLETION& = &HC0&
Private Const WAIT_OBJECT_0& = 0
Private Const WAIT_OBJECT_1& = 1
Private Const WAIT_TIMEOUT& = &H102&

Private Const INFINITE = &HFFFF
Private Const ERROR_ALREADY_EXISTS = 183&

Private Const QS_HOTKEY& = &H80
Private Const QS_KEY& = &H1
Private Const QS_MOUSEBUTTON& = &H4
Private Const QS_MOUSEMOVE& = &H2
Private Const QS_PAINT& = &H20
Private Const QS_POSTMESSAGE& = &H8
Private Const QS_SENDMESSAGE& = &H40
Private Const QS_TIMER& = &H10
Private Const QS_MOUSE& = (QS_MOUSEMOVE _
                            Or QS_MOUSEBUTTON)
Private Const QS_INPUT& = (QS_MOUSE _
                            Or QS_KEY)
Private Const QS_ALLEVENTS& = (QS_INPUT _
                            Or QS_POSTMESSAGE _
                            Or QS_TIMER _
                            Or QS_PAINT _
                            Or QS_HOTKEY)
Private Const QS_ALLINPUT& = (QS_SENDMESSAGE _
                            Or QS_PAINT _
                            Or QS_TIMER _
                            Or QS_POSTMESSAGE _
                            Or QS_MOUSEBUTTON _
                            Or QS_MOUSEMOVE _
                            Or QS_HOTKEY _
                            Or QS_KEY)

Private Declare Function CreateWaitableTimer Lib "kernel32" _
    Alias "CreateWaitableTimerA" ( _
    ByVal lpSemaphoreAttributes As Long, _
    ByVal bManualReset As Long, _
    ByVal lpName As String) As Long

Private Declare Function OpenWaitableTimer Lib "kernel32" _
    Alias "OpenWaitableTimerA" ( _
    ByVal dwDesiredAccess As Long, _
    ByVal bInheritHandle As Long, _
    ByVal lpName As String) As Long

Private Declare Function SetWaitableTimer Lib "kernel32" ( _
    ByVal hTimer As Long, _
    lpDueTime As FILETIME, _
    ByVal lPeriod As Long, _
    ByVal pfnCompletionRoutine As Long, _
    ByVal lpArgToCompletionRoutine As Long, _
    ByVal fResume As Long) As Long

Private Declare Function CancelWaitableTimer Lib "kernel32" ( _
    ByVal hTimer As Long)

Private Declare Function CloseHandle Lib "kernel32" ( _
    ByVal hObject As Long) As Long

Private Declare Function WaitForSingleObject Lib "kernel32" ( _
    ByVal hHandle As Long, _
    ByVal dwMilliseconds As Long) As Long

Private Declare Function MsgWaitForMultipleObjects Lib "user32" ( _
    ByVal nCount As Long, _
    pHandles As Long, _
    ByVal fWaitAll As Long, _
    ByVal dwMilliseconds As Long, _
    ByVal dwWakeMask As Long) As Long
Public Sub Wait(lNumberOfSeconds As Long)
    Dim ft As FILETIME
    Dim lBusy As Long
    Dim lRet As Long
    Dim dblDelay As Double
    Dim dblDelayLow As Double
    Dim dblUnits As Double
    Dim hTimer As Long

    hTimer = CreateWaitableTimer(0, True, App.EXEName & "Timer")

    If Err.LastDllError = ERROR_ALREADY_EXISTS Then
        ' If the timer already exists, it does not hurt to open it
        ' as long as the person who is trying to open it has the
        ' proper access rights.
    Else
        ft.dwLowDateTime = -1
        ft.dwHighDateTime = -1
        lRet = SetWaitableTimer(hTimer, ft, 0, 0, 0, 0)
    End If

    ' Convert the Units to nanoseconds.
    dblUnits = CDbl(&H10000) * CDbl(&H10000)
    dblDelay = CDbl(lNumberOfSeconds) * 1000 * 10000

    ' By setting the high/low time to a negative number, it tells
    ' the Wait (in SetWaitableTimer) to use an offset time as
    ' opposed to a hardcoded time. If it were positive, it would
    ' try to convert the value to GMT.
    ft.dwHighDateTime = -CLng(dblDelay / dblUnits) - 1
    dblDelayLow = -dblUnits * (dblDelay / dblUnits - _
        Fix(dblDelay / dblUnits))

    If dblDelayLow < CDbl(&H80000000) Then
        ' &H80000000 is MAX_LONG, so you are just making sure
        ' that you don't overflow when you try to stick it into
        ' the FILETIME structure.
        dblDelayLow = dblUnits + dblDelayLow
        ft.dwHighDateTime = ft.dwHighDateTime + 1
    End If

    ft.dwLowDateTime = CLng(dblDelayLow)
    lRet = SetWaitableTimer(hTimer, ft, 0, 0, 0, False)

    Do
        ' QS_ALLINPUT means that MsgWaitForMultipleObjects will
        ' return every time the thread in which it is running gets
        ' a message. If you wanted to handle messages in here you could,
        ' but by calling Doevents you are letting DefWindowProc
        ' do its normal windows message handling---Like DDE, etc.
        lBusy = MsgWaitForMultipleObjects(1, hTimer, False, _
            INFINITE, QS_ALLINPUT&)
        DoEvents
    Loop Until lBusy = WAIT_OBJECT_0

    ' Close the handles when you are done with them.
    CloseHandle hTimer

End Sub


MyndFyre

Quote from: Tazo on May 06, 2006, 12:04 PM
Credits to MSDN, forgot where I found it or I'd link you. Waits for X seconds without freezing your thread, like Sleep() does.

Or... you could use a good language that supports multithreading!  :P
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.