Click here to Skip to main content
15,891,864 members
Home / Discussions / COM
   

COM

 
QuestionConnecting Multiple clients to single server using DCOM Pin
abhiramsss27-Feb-06 18:21
abhiramsss27-Feb-06 18:21 
AnswerRe: Connecting Multiple clients to single server using DCOM Pin
FearlessBurner6-Mar-06 1:51
FearlessBurner6-Mar-06 1:51 
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
abhiramsss8-Mar-06 19:10
abhiramsss8-Mar-06 19:10 
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
abhiramsss9-Mar-06 23:31
abhiramsss9-Mar-06 23:31 
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
FearlessBurner10-Mar-06 0:18
FearlessBurner10-Mar-06 0:18 
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
abhiramsss12-Mar-06 20:09
abhiramsss12-Mar-06 20:09 
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
abhiramsss13-Mar-06 22:30
abhiramsss13-Mar-06 22:30 
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
FearlessBurner16-Mar-06 4:25
FearlessBurner16-Mar-06 4:25 
How many applications do you have that need to send output to the server GUI?

If the answer is just one or two, then you could just write a short function to create the COM interface object on the remote server, use it, and then release the interface. The downside of doing this would be that several round trips between the client and server computers would be necessary, resulting in time delays, plus you would need to deal with the security issues in all the client programs, and of course the server.

What sort of scale are we discussing here? How many messages would need to be sent. Would you need to keep the interface open during the total life of the client program, or could it open just when sending messages to the server?

If you wanted to recreate the com interface every time that you wish to send a message, you could write some code like this (using MFC CStrings, but these could be replaced with other types):

int PrintToServerGUI( LPCTSTR szFormat, ... )<br />
{<br />
   int nTextLen = 0;<br />
   if ( szFormat )<br />
   {<br />
      CString strOut;<br />
      va_list p_arg;<br />
      va_start( p_arg, szFormat );<br />
      strOut.FormatV( szFormat, p_arg );<br />
      nTextLen = strOut.GetLength();<br />
      va_end( p_arg );<br />
   }<br />
   int nWritten = 0;<br />
   if ( nTextLen > 0 )<br />
   {<br />
      // Create interface to my server GUI<br />
      IMyServerGUI *pMyServer = NULL;<br />
      ... // Code for creating interface using CoCreateInstanceEx() eg<br />
      ... // hr = CoCreateInstanceEx(CLSID_MyServer, NULL, CLSCTX_REMOTE_SERVER, &csi, 1, qi );<br />
      ... // pMyServer = static_cast<IMyServerGUI *>(qi[0].pItf);<br />
      ...<br />
      if ( pMyServer )<br />
      {<br />
         if ( SUCCEEDED( pMyServer->OutputString( strOut ) ) )<br />
         {<br />
            nWritten = nTextLen;<br />
         }<br />
         pMyServer->Release();<br />
      }<br />
   }<br />
   return nTextLen;<br />
}


You need to write your own interface creation code for your com interface. Note that is code assumes that you have a function in your interface called OutputString( LPCTSTR pString ).

If there are a lot of applications that need to communicate with the server, then it may be better to use an intermediate server programming on the local client, that would then pass the messages as appropriate to the server program. The advantage would be that in network security terms, you would only need to concern yourself with the traffic between the server and intermediate server.
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
abhiramsss19-Mar-06 21:24
abhiramsss19-Mar-06 21:24 
GeneralRe: Connecting Multiple clients to single server using DCOM Pin
FearlessBurner22-Mar-06 6:51
FearlessBurner22-Mar-06 6:51 
QuestionAutomation Server Can't Create Object Pin
bigmacrox27-Feb-06 12:46
bigmacrox27-Feb-06 12:46 
AnswerRe: Automation Server Can't Create Object Pin
mbue27-Feb-06 16:18
mbue27-Feb-06 16:18 
QuestionODBC dropping cell values Pin
RB@Emphasys27-Feb-06 5:30
RB@Emphasys27-Feb-06 5:30 
QuestionDrag-and-Drop in explorer.exe. Pin
Jerry New26-Feb-06 17:20
Jerry New26-Feb-06 17:20 
AnswerRe: Drag-and-Drop in explorer.exe. Pin
mbue27-Feb-06 16:21
mbue27-Feb-06 16:21 
QuestionCOM Component... Pin
Siva Sankar Koyi24-Feb-06 21:13
Siva Sankar Koyi24-Feb-06 21:13 
AnswerRe: COM Component... Pin
Lim Bio Liong24-Feb-06 23:31
Lim Bio Liong24-Feb-06 23:31 
GeneralRe: COM Component... Pin
AmitGG28-Feb-06 22:11
AmitGG28-Feb-06 22:11 
QuestionImplement a new interface Pin
zubair_ahmed23-Feb-06 19:32
zubair_ahmed23-Feb-06 19:32 
AnswerRe: Implement a new interface Pin
Lim Bio Liong24-Feb-06 23:23
Lim Bio Liong24-Feb-06 23:23 
AnswerRe: Implement a new interface Pin
mbue27-Feb-06 16:14
mbue27-Feb-06 16:14 
QuestionHow to catch ActiveX Install or Excute using BHO? Pin
Blue-Bird23-Feb-06 19:00
Blue-Bird23-Feb-06 19:00 
QuestionError In Building simple ATL application Pin
maharaja pandian23-Feb-06 1:49
maharaja pandian23-Feb-06 1:49 
AnswerRe: Error In Building simple ATL application Pin
toxcct23-Feb-06 2:13
toxcct23-Feb-06 2:13 
AnswerRe: Error In Building simple ATL application Pin
Stephen Hewitt23-Feb-06 19:20
Stephen Hewitt23-Feb-06 19:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.