Remote function

Posted on 2004-11-21
Last Modified: 2011-09-20

I have two computers networked together; one has  C++ socket server app and is listening on port 5900 (or whichever)

The other computer has a C++ socket client app and establishes a connection to the server through port 5900.

My question is, using C++ (no MFC)  how am I able to call a MessageBox function from the client so that it is executed on the server?

Thanks for your time
Question by:PastorDwayne
    LVL 55

    Expert Comment

    by:Jaime Olivares
    Just have to establish your own protocol at client and server, define some "command" (either a word or a value) that client can send to the server, once the server recognize that command, it must open a message box and show the message sent trough the socket connection.

    Author Comment

    Thanks for your response;

    could you give me a short code example as to how to do this on the client and server?

    Thanks again.
    LVL 55

    Accepted Solution

    I don't know about your complete project, but if you have an already connected socket link, then you have to send some message from client using the send() function, you can send a string like:

    MSGBOX:This is a test message

    Then on your listen/receive function at server, you have to wait for a similar command string to arrive.

    // Wait for receiving function, put it into buffer (char [] type)

    if (!strcmp(buffer,"MSGBOX:")) {
        MessageBox(NULL, buffer+7, "Message from client", MB_OK);

    Have a look to this tutorial article:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
    C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
    The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now