[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Remote function

Good-day,

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
0
PastorDwayne
Asked:
PastorDwayne
  • 2
1 Solution
 
Jaime OlivaresCommented:
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.
0
 
PastorDwayneAuthor Commented:
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.
0
 
Jaime OlivaresCommented:
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:
http://www.codeproject.com/internet/client_server_socket.asp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now