I am newbie in programing, and learning it...

I need to know how do i make that program:
Examples will help...

I need to use UDP communication to connect to server by client and search, at server,for the longest directory, get the longest directory path and number of deepest level, sand it back to client and print it at client.
Also, the server will return the number of clients who connected to the Server.
And print it both at server and client side.

The Client and Server run on windows console (without GUI).
The Client will have basic DOS menu, that the USER can select
1. "Start Search and Print Results".
2. "Print Last results (deepest level)".
3. "Print Last result (Path)".
4. "Print Number of Clients".
5. "Exit".

Thank you, in advance!
It like a project for me, and really need how to make it work...

Thanks again for helpers, experts!

i have make scan for deepest level for local client , i do not have a clue how to switch for UDP connection, please help.

Here what i have done so far:

#pragma warning(disable : 4996)

#include "Scan API.h"

//**************************************************************
typedef struct
{
    int nDeepestLevel;
    char sDeepestDirectory[MAX_PATH+1];
}
DEEPEST_LEVEL_INFO;

//************************************************************** 

BOOL DeepestDirectory(int nLevel, const char* pPath, const WIN32_FIND_DATA* pFD, void* pParam)
{
    DEEPEST_LEVEL_INFO* pDLI = (DEEPEST_LEVEL_INFO *)pParam;

    if (nLevel == pDLI->nDeepestLevel)
    {
        pDLI->nDeepestLevel = nLevel + 1;
        strcat(strcat(strcpy(pDLI->sDeepestDirectory, pPath), "\\"), pFD->cFileName);
    }
    return TRUE;
}

//**************************************************************

int GetLongestDirectoryChain(const char* pPath, char* pChain)
{
    //* Initialize globals
        DEEPEST_LEVEL_INFO dli;
        dli.nDeepestLevel = 0;
        dli.sDeepestDirectory [0] = 0;

        //* Start scanning
        Scan(pPath, DeepestDirectory, 0, &dli);
        strcpy(pChain, dli.sDeepestDirectory);

    return dli.nDeepestLevel;
}

//**************************************************************

Also, make Scan API.h for order scan the file (findfirst, findnext...).

Thanks!

Edited 3 Years Ago by pyTony: fixed formatting

This article has been dead for over six months. Start a new discussion instead.