Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Passing parameters between 2 programmes

Posted on 2003-02-18
Medium Priority
Last Modified: 2010-04-15

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.

Question by:franklyflee

Accepted Solution

akshayxx earned 80 total points
ID: 7979529
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


Expert Comment

ID: 7980508
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.

Author Comment

ID: 7997148
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.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 7997202
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.

LVL 12

Expert Comment

ID: 8014951
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
LVL 20

Expert Comment

ID: 10004330
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.


EE Cleanup Volunteer

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Suggested Courses

577 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