FlashFXP Forums

FlashFXP Forums (https://oss.azurewebsites.net/forum/)
-   Programming (https://oss.azurewebsites.net/forum/community-chatter/programming/)
-   -   Question about ONLINEDATA and -1 as CID/UID (https://oss.azurewebsites.net/forum/community-chatter/programming/7886-question-about-onlinedata-1-cid.html)

ADDiCT 02-19-2004 01:59 PM

Question about ONLINEDATA and -1 as CID/UID
 
I think i found the problem why my shmem tools crash ioFTPD when i run more than one. (tested on 5.6.3r)

I created a test script that sends request for ONLINEDATA in an endless loop, so +100 times per second.

When i run one process of the script, all is fine, always returns "No Users Online".
When i start a second process, ioFTPD instantly crashes.

After a little looking around, it seems CID is set to -1. I was only checking for UID = -1 to skip those online users.
But is it normal that, although there are no online users, ioFTPD replies that there is atleast one online user, and it has CID = -1 ?
Because i never read anything about that, only that i should ignore online users with UID = -1.

I'll just replace the code in my scripts to check for both CID and UID = -1, that way, i was able to run as much instances of my hammering script as i want without a single crash.

Mouton 02-19-2004 02:10 PM

the part of code i use which is probably from dark's example(s)...
which is also the code for ioBmonitor i posted lower in this forum...

Code:

while (nPos != -1 && Users < 1000 ) {
    // Initial setup for DC_GET_ONLINEDATA
    lpMessage->dwIdentifier    = DC_GET_ONLINEDATA;
    LPDC_ONLINEDATA pOnlineData = (LPDC_ONLINEDATA)lpMessage->lpContext;
    pOnlineData->iOffset = nPos;
    pOnlineData->dwSharedMemorySize = sizeof(DC_MESSAGE) + sizeof(DC_ONLINEDATA) + (_MAX_PATH + 1) * 2;

    // Send Message
    SendMessage(hIoFTPD, WM_SHMEM, NULL, (LPARAM)hMemory);

    // Wait until processed (5 secs)
    if (WaitForSingleObject(hEvent, 2000) == WAIT_TIMEOUT) break;
    if (!lpMessage->dwReturn) {
        nPos = pOnlineData->iOffset;
        if (iPos>=nPos || nPos == 1024)
            break;

        ...

        int UserId = pOnlineData->OnlineData.Uid;
        if (UserId==-1) continue;

        ...

        Users++;
        iPos = nPos;
    }
    if (lpMessage->dwReturn == (DWORD)-1)
        break;
    pOnlineData->iOffset++;
}


ADDiCT 02-19-2004 02:17 PM

if (iPos>=nPos || nPos == 1024)

-> what is the initial value of iPos? if it's 0, it would explain my problem

edit: found it in another thread, it is indeed 0.

:banana:


All times are GMT -5. The time now is 04:48 PM.

Powered by vBulletin® Version 3.8.11 Alpha 3
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)