Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 02-19-2004, 01:59 PM   #1
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default 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.
ADDiCT is offline  
Old 02-19-2004, 02:10 PM   #2
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

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++;
}
Mouton is offline  
Old 02-19-2004, 02:17 PM   #3
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default

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:
ADDiCT is offline  
Closed Thread

Tags
online, run, script, uid, users

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:47 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)