Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. QLocalServer with Win32 pipe
Forum Updated to NodeBB v4.3 + New Features

QLocalServer with Win32 pipe

Scheduled Pinned Locked Moved C++ Gurus
3 Posts 3 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul S
    wrote on last edited by
    #1

    What I'd like to achieve:
    I'm trying to develop a memory pipe server which will be in Qt (QLocalServer) and client in C++ win32.
    I've used an example source on QLocalSocket and QLocalServer to ensure my server is working correctly.

    What I've tried:
    Here is the client source for the memory pipe.
    @
    cIPC_t::cIPC_t(char *szPipeName)
    {
    this->hPipe = 0;
    strcpy_s(this->szPipeName, "\\.\pipe\");
    strcat_s(this->szPipeName, szPipeName);
    }

    bool cIPC_t::connect(void)
    {
    hPipe = CreateFileA(this->szPipeName, GENERIC_READ | GENERIC_WRITE, NULL, NULL, OPEN_EXISTING, 0, NULL);
    cout << "CreateFile. " << GetLastError() << "\n";
    bool boRet = false;
    return boRet;
    }

    bool cIPC_t::send(char *szMessage)
    {

    DWORD dwWrittenBytes = 0;
    if(WriteFile(hPipe, reinterpret_cast<LPCVOID>(szMessage), strlen(szMessage)+1, &dwWrittenBytes, NULL) == 0)
    {
    cout << "send. Error " << GetLastError() << "\n";
    CloseHandle(hPipe);
    return true;
    }

    CloseHandle(hPipe);
    return false;
    }

    int main(void)
    {
    cIPC_t IPC("Client2");
    IPC.connect();
    IPC.send("HelloWorld");
    }@
    There are no errors according the GetLastError().
    The server memory pipe is called "Client2" the packet is received on my server but the message length is 0.

    Thanks for reading. Would be grateful if anyone had any suggestions or tips.

    Regards,
    Paul

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ckakman
      wrote on last edited by
      #2

      Hi,

      Can you also post your server code?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alpha_one_x86
        wrote on last edited by
        #3

        Look the catchcopy explorer plugin code, I have do that's.

        The best way to do file copy is in Qt:
        http://ultracopier.first-world.info/

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved