Link to home
Start Free TrialLog in
Avatar of franklyflee
franklyflee

asked on

Passing parameters between 2 programmes

Hi,

I'm working on a client and server programme and I wanna pass parameters between the two programmes, does anyone know how to write it or what functions should I use? Actually I don't want any TCP stuff, it's kinda too complicated. I want the simplest one, just enough to exchange information between two programmes will be fine. It'll be real good if u have some source codes, hehe. Thanz.

Franky
ASKER CERTIFIED SOLUTION
Avatar of akshayxx
akshayxx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pankajtiwary
pankajtiwary

To exchange data between two programs or rather processes, you need to implement IPC (Interprocess Communication). There are ways to do that.

1. Pipes
2. Semaphores
3. Message queues
4. Shares Memory

I think the simplest will be the 'pipes'. A pipe is simply a kind of connection through which the data flows across two process.
A pipe can be easily be opened in Unix using popen() system call in read or write mode. A pipe opening in read mode means you are sucking the data from the pipe. Whereas write mode means you are using it to take the data out of your process.
More information can be found from the Unix man pages.
Avatar of franklyflee

ASKER

Oh...pipes.....so do any of u guys have source codes on it? hehe. Well, i'm searching for some now. Actually I'm doing a project on smart card and I need to exchange information between those two programs "Card" and "Reader". Th project is not really about connection, port, socket or anything like that, so I think I'll use the simplest one. That's the pipes right? Ok...Thanz really.

Franky
And yes I'm using cygwin to compile the C programme. It's always getting me into trouble coz it's always saying it cannot recognize some of the libraries. Anywayz, the platform is Windows XP. I think I can still use those programmes in UNIX, is that right? Ok, so I'll get back to my search on the source codes, hehe.

Franky
I think the TCP/IP interface is the easiest one. Others are bit complicated, as other people have said, INTERPROCESS COMMUNICATION and all.

Better you go through the sockets interface it is very easy, as easy as using a file. The interface is quite similer to that. Check it out.

Thank you
Nothing has happened on this question in over 10 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by akshayxx.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer