473,378 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Inter-process communication

Hello,

I need a way to increment an integer whenever a certain process starts
on the computer. Essentially, the integer is an index to a resource
and I don't want two processes using the same resource.

I need the first process to start somesort of a registration thing and
then every other process after that will register and get a new index.
It needs to be as lightweight as possible so remoting is out. I also
don't want to use the registry or some file stored on the computer. Is
there anything more elegant than those previous answers?

Thanks,

Stephen Inkpen
stephen.inkpen@**SPAM**cathexis.ca
Jul 21 '05 #1
2 1314
Stephen Inkpen <si*****@cs.mun.ca> wrote:
I need a way to increment an integer whenever a certain process starts
on the computer. Essentially, the integer is an index to a resource
and I don't want two processes using the same resource.

I need the first process to start somesort of a registration thing and
then every other process after that will register and get a new index.
It needs to be as lightweight as possible so remoting is out. I also
don't want to use the registry or some file stored on the computer. Is
there anything more elegant than those previous answers?


I'd suggest using a simple port - you initially try to listen on a
port, and if that fails you try to connect to the port to get your
index.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
You said you don't want to use the registry, but you didn't say why. It's
the first thing that came to mind since you can do it with one line of code...

Depending on your other requirements, you could consider using the Mutex
class. The constructor that takes a String param works across processes.

"Stephen Inkpen" wrote:
Hello,

I need a way to increment an integer whenever a certain process starts
on the computer. Essentially, the integer is an index to a resource
and I don't want two processes using the same resource.

I need the first process to start somesort of a registration thing and
then every other process after that will register and get a new index.
It needs to be as lightweight as possible so remoting is out. I also
don't want to use the registry or some file stored on the computer. Is
there anything more elegant than those previous answers?

Thanks,

Stephen Inkpen
stephen.inkpen@**SPAM**cathexis.ca

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tertius Cronje | last post by:
Hi All, Q: Is it possible for a thread on SocketServer.ThreadingTCPServer to get the socket info of *other* open thread/s and use that info to send data to the accepting client? I wrote a...
1
by: Thierry Marneffe | last post by:
Hello Suppose a database Db1 with tables tl1 and tl2 and a second database db2 with tables tl3 et tl4. Is it possible to make a join between tables of the two databases ? As for example,...
1
by: David M. Karr | last post by:
I've been asked to help debug a complex problem involving inter-frame references, so I just want to understand the elements involved with this. Apparently, there is a page with multiple frames,...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
6
by: les | last post by:
Here's a class which uses 2.0 generics to implement an inter-thread message queue in C#. Any number of threads can post and read from the queue simultaneously, and the message object can be any...
7
by: Sumedh | last post by:
Hi everyone There is a C# project which calls C++/CLI dll to be able to call native C++ including templates. But the C++/CLI code itself also requires the C# dll to get the types. For example: ...
1
by: Laurence | last post by:
Hi folks, As I konw: database partition (aka data partition?), the database can span multiple machines; table partition, the data within a table can seperate by certain condition. How about...
1
by: halekio | last post by:
Hi all, Please bear with me as I've only started programming in C# 2 weeks ago and this is my first contact with OOP. I ran into a situation where I needed to catch an event in an object that...
0
by: rkprasad | last post by:
I am able to create BASIC-CLEAR-INTEGRATED sql http endpoint and consume it on a LAN. But i am not able to consume the created endpoint on inter domain network. If i create endpoint on a server...
1
by: rsennat | last post by:
Hi, what is the order of the libraries in the Makefile, for linking inter dependent libraries. i'm getting linker error for the following scenario. I have lib1.a and lib2.a, with which lib1.a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.