Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
how to call function at server

 
Post new topic   Reply to topic    dna88 Forum Index -> Windows Discussion Forum
Author Message
johnjohn11
Just In
Just In


Joined: 14 Jun 2004
Posts: 1

Post Post subject: how to call function at server Reply with quote

Hello everybody,

I need some help from you.

It is all around socket programming.
I got my client and server worked, it is just a simple socket programming with read() and write().

Suppose I know there is a function at the server side: void foo(char *bar).
Is it possible from client to call this function? if yes, how can i do this? what should i do?

thank you
Mon Jun 14, 04 3:35 pm
Back to top
johnjohn11 View user's profile Send private message
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Call a function of the server with socket Reply with quote

The way socket servers and client programs work, this is mainly determined by the server side program. If the server side socket is allowed to response to a reuqest to run the foo() function, then it can execute the function. The client side program does not have much control on it. Client side can only initiate a request, say with an ID number 3021. Server side program checks the id number from the request and if the client is authenticated and the id number is associated with the function then the server program starts the function.

More details would be helpful to see if it can be done what you are really trying to do. If you are writing the program in any version of C or VC++, you can post a new thread in C forum. There are some netwroking experts talk in there.
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Mon Jun 14, 04 9:49 pm
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
Guest






Post Post subject: Reply with quote

what i want to do is something like this

server and client communicate with TCP
there is a function in server call void foo(char *bar),

server.c
void foo(char *bar)
{
sprintf("yes", bar);
}

I want at the client to call that function. Can I write something like this in client?

client.c

char *A;
foo(&A);

and when i call the function I got "yes" in A

is this possible to do?
Tue Jun 15, 04 1:33 am
Back to top
Guest
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

This looks to be certainly possible. But I am not really a C guy. Post the problem and code in the C forum...you will get a definitive answer in a few hours.
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Tue Jun 15, 04 1:43 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
Tousif
Beginner User
Beginner User


Joined: 25 May 2004
Posts: 20
Location: Nashville, Tennessee, USA

Post Post subject: Reply with quote

Hi,
What you are looking for is Remote Procedure Call - RPC. It is not really possible to give a detailed description of the RPC here..however this link below I think gives quite a detailed description of the usage of the C RPC library.

[http://www.cs.cf.ac.uk/Dave/C/node33.html]

By the way...the C/C++ forum would be the appropriate place for this thread.

Cheers,
Tousif
Tue Jun 15, 04 11:13 am
Back to top
Tousif View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Windows Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group