Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Remote COM

Remote COM

Scheduled Pinned Locked Moved C / C++ / MFC
c++comsysadminhelpquestion
13 Posts 2 Posters 0 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.
  • R Offline
    R Offline
    RevathiRamakumar
    wrote on last edited by
    #1

    I have ATL COM server and a dialog based application as a client..I need to test my server on a remote machine and access the method of the server from my local client... copied the exe of the server on the remote machine and I have used CoCreateInstanceEx to create a instance of the remote server..Should i Need to do anything else..Should I create proxy/stub for my application? If so ,how can build proxy/stub?Please help me out... Thank U...:confused:

    C 1 Reply Last reply
    0
    • R RevathiRamakumar

      I have ATL COM server and a dialog based application as a client..I need to test my server on a remote machine and access the method of the server from my local client... copied the exe of the server on the remote machine and I have used CoCreateInstanceEx to create a instance of the remote server..Should i Need to do anything else..Should I create proxy/stub for my application? If so ,how can build proxy/stub?Please help me out... Thank U...:confused:

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      RevathiRamakumar wrote:

      Should i Need to do anything else

      Nope.

      RevathiRamakumar wrote:

      Should I create proxy/stub for my application? If so ,how can build proxy/stub?

      Nope. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      R 1 Reply Last reply
      0
      • C CPallini

        RevathiRamakumar wrote:

        Should i Need to do anything else

        Nope.

        RevathiRamakumar wrote:

        Should I create proxy/stub for my application? If so ,how can build proxy/stub?

        Nope. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        R Offline
        R Offline
        RevathiRamakumar
        wrote on last edited by
        #3

        Thank u.. But then, Im not able to connect to the remote COM...What should be wrong then? Thank u..

        C 1 Reply Last reply
        0
        • R RevathiRamakumar

          Thank u.. But then, Im not able to connect to the remote COM...What should be wrong then? Thank u..

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          I don't know. You should possibly post your calling code.BTW, what was the CoCreateInstanceEx return value? :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          R 1 Reply Last reply
          0
          • C CPallini

            I don't know. You should possibly post your calling code.BTW, what was the CoCreateInstanceEx return value? :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            R Offline
            R Offline
            RevathiRamakumar
            wrote on last edited by
            #5

            This is my client code that calls the COM server on the remote machine...Thank u.. HRESULT hr; IIGetFile2* pGetFile; // IUnknown* pUnknown = 0; COSERVERINFO ServerInfo = {0,0,0,0}; wchar_t * remotemachine = L"servername"; ServerInfo.pwszName = remotemachine; //MULTI_QI qi = {&__uuidof(IGetFile2),NULL,S_OK}; MULTI_QI qi={0,0,0}; qi.pIID = &IID_IUnknown; // IIGetFile2 * pInt = static_cast<IIGetFile2 *>(qi.pItf); USES_CONVERSION; CComPtr<IIGetFile2> Ptr1; qi.pIID = &IID_IIGetFile2; // hr = CoCreateInstanceEx(CLSID_IGetFile2,NULL,CLSCTX_REMOTE_SERVER,&ServerInfo,1, &qi); pUnknown = (IUnknown*)qi.pItf; if(SUCCEEDED(hr)) { AfxMessageBox("SUCCEEDED CoCreateEX"); } pUnknown = (IUnknown*)qi.pItf; hr = pUnknown->QueryInterface(IID_IIGetFile2, (void**)&pGetFile); hr = pUnknown->Release(); if(SUCCEEDED(hr)) { AfxMessageBox("SUCCEEDED QI"); _bstr_t bstrFileContent = pGetFile->GetFile2(); char* Text = _com_util::ConvertBSTRToString(bstrFileContent); m_edit=Text; UpdateData(FALSE); }

            C 1 Reply Last reply
            0
            • R RevathiRamakumar

              This is my client code that calls the COM server on the remote machine...Thank u.. HRESULT hr; IIGetFile2* pGetFile; // IUnknown* pUnknown = 0; COSERVERINFO ServerInfo = {0,0,0,0}; wchar_t * remotemachine = L"servername"; ServerInfo.pwszName = remotemachine; //MULTI_QI qi = {&__uuidof(IGetFile2),NULL,S_OK}; MULTI_QI qi={0,0,0}; qi.pIID = &IID_IUnknown; // IIGetFile2 * pInt = static_cast<IIGetFile2 *>(qi.pItf); USES_CONVERSION; CComPtr<IIGetFile2> Ptr1; qi.pIID = &IID_IIGetFile2; // hr = CoCreateInstanceEx(CLSID_IGetFile2,NULL,CLSCTX_REMOTE_SERVER,&ServerInfo,1, &qi); pUnknown = (IUnknown*)qi.pItf; if(SUCCEEDED(hr)) { AfxMessageBox("SUCCEEDED CoCreateEX"); } pUnknown = (IUnknown*)qi.pItf; hr = pUnknown->QueryInterface(IID_IIGetFile2, (void**)&pGetFile); hr = pUnknown->Release(); if(SUCCEEDED(hr)) { AfxMessageBox("SUCCEEDED QI"); _bstr_t bstrFileContent = pGetFile->GetFile2(); char* Text = _com_util::ConvertBSTRToString(bstrFileContent); m_edit=Text; UpdateData(FALSE); }

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              Fine. Is your server machine name "servername" (or simply is the name in your real code correct? What about the hr (the CoCreateinstanceEx return value)? And what about qi.hr value? :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              R 1 Reply Last reply
              0
              • C CPallini

                Fine. Is your server machine name "servername" (or simply is the name in your real code correct? What about the hr (the CoCreateinstanceEx return value)? And what about qi.hr value? :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                R Offline
                R Offline
                RevathiRamakumar
                wrote on last edited by
                #7

                No, Its RDSServer ..I have given it correctly...:confused: CoCreateinstanceEx hr=-2147023174 and for qi.hr I get access violation exception...

                C 1 Reply Last reply
                0
                • R RevathiRamakumar

                  No, Its RDSServer ..I have given it correctly...:confused: CoCreateinstanceEx hr=-2147023174 and for qi.hr I get access violation exception...

                  C Offline
                  C Offline
                  CPallini
                  wrote on last edited by
                  #8

                  Your error code corrensponds to: "Error 0x800706ba - The RPC server is unavailable" see, for instance, this page [^] for some info. :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  R 1 Reply Last reply
                  0
                  • C CPallini

                    Your error code corrensponds to: "Error 0x800706ba - The RPC server is unavailable" see, for instance, this page [^] for some info. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    R Offline
                    R Offline
                    RevathiRamakumar
                    wrote on last edited by
                    #9

                    Thank u...Let me try out... :)

                    R 1 Reply Last reply
                    0
                    • R RevathiRamakumar

                      Thank u...Let me try out... :)

                      R Offline
                      R Offline
                      RevathiRamakumar
                      wrote on last edited by
                      #10

                      Hi...I have another doubt..In case of testing both client and server on the local machine I have used this include statement... #import "..\FileServer\FileServer.tlb" using namespace FILESERVERLib; But, When testing the server on the remote machine what kind of import statement Should I give..? Thank u...

                      C 1 Reply Last reply
                      0
                      • R RevathiRamakumar

                        Hi...I have another doubt..In case of testing both client and server on the local machine I have used this include statement... #import "..\FileServer\FileServer.tlb" using namespace FILESERVERLib; But, When testing the server on the remote machine what kind of import statement Should I give..? Thank u...

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #11

                        The import statement is used, on the client side, to build the client itself. It has nothing to with the testing phase (i.e. use always such statement to build the client and then forget about it...) :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        R 1 Reply Last reply
                        0
                        • C CPallini

                          The import statement is used, on the client side, to build the client itself. It has nothing to with the testing phase (i.e. use always such statement to build the client and then forget about it...) :)

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          R Offline
                          R Offline
                          RevathiRamakumar
                          wrote on last edited by
                          #12

                          Thank u..So,u mean to say that it has nothing to do with my remote access...Right..

                          R 1 Reply Last reply
                          0
                          • R RevathiRamakumar

                            Thank u..So,u mean to say that it has nothing to do with my remote access...Right..

                            R Offline
                            R Offline
                            RevathiRamakumar
                            wrote on last edited by
                            #13

                            Hi.. I tried the code.. When I'm trying to create an instance on the remote machine I get ACCESS DENIED error.. I have the security permissions for the DCOM though.. Thank U...:confused:

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups