• C

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
franklyfleeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

akshayxxCommented:
if you think TCP is a bit too complicated .. then u'll find other ways of interprocess communication also not that easy.
btw what OS and compiler r you working on?
here are some methods to for IPC  on UNIX like systems
shared memory,
message queues,
named pipes,
file system ( esp /proc file system)
and obviously sockets.
i might have missed some names , but these are the most common

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pankajtiwaryCommented:
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.
0
franklyfleeAuthor Commented:
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
0
Get Cisco Certified in IT Security

There’s a high demand for IT security experts and network administrators who can safeguard the data that individuals, corporations, and governments rely on every day. Pursue your B.S. in Network Operations and Security and gain the credentials you need for this high-growth field.

franklyfleeAuthor Commented:
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
0
rajeev_devinCommented:
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
0
jmcgOwnerCommented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.