Article View: borland.public.jbuilder.java.language
Article #7347Re: ?? Prevent starting a Programm twice???
From: Joi Ellis [TeamB]
Date: Wed, 27 Jun 2001 22:55
Date: Wed, 27 Jun 2001 22:55
55 lines
2558 bytes
2558 bytes
Petar Banicevic <petar_b@usa.net> wrote: > Can you tell me please how to do that ? > How to retreive a list of processes ? This is platform-specific, and the only way I know of to do it is to either right JNI code, or use Runtime.exec() to call a local command to find out. I'd stick with opening a ServerSocket. That's native java and should work everywhere. > "dnoyeB" <lamont_gilbert @ rigidsoftware.com> wrote in message > news:3b39da80$1_1@dnews... >> You can alternately check the running processes for a processes that > carries >> your name. >> >> >> >> >> "Joi Ellis [TeamB]" <joi@aravox.com> wrote in message >> news:3b39d418_1@dnews... >> > Peter Lustig <kschnepp@web.de> wrote: >> > >> > > I am searching for an easy way to prevent starting the same Programm >> manifold on a Computer. >> > >> > Have the program open a ServerSocket on a specific port. If it is able > to >> > open the port, then it's the only instance of the program running. >> > If it can't open the socket, either there are multiple copies of the >> program >> > running, or something else is using the port. You can make the port > user >> > configurable if you need to, as long as the program writes the new port >> number >> > someplace permanent >> > >> > >> > -- >> > Joi Ellis (TeamB) http://www.teamb.com/ >> > No direct email, please. >> > For best results, post on news server newsgroups.borland.com! >> > Newsgroup Info: http://www.borland.com/newsgroups/guide.html >> >> -- Joi Ellis (TeamB) http://www.teamb.com/ No direct email, please. For best results, post on news server newsgroups.borland.com! Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<3b3a6463_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!not-for-mailReferences:
<3b398972$1_1@dnews> <3b39d418_1@dnews> <3b39da80$1_1@dnews> <3b3a1f7a_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,5fc10420f14b88fa
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-27 16:03:55 PST
Message-ID: <3b3a6463_1@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: ?? Prevent starting a Programm twice???
Newsgroups: borland.public.jbuilder.java.language
References: <3b398972$1_1@dnews> <3b39d418_1@dnews> <3b39da80$1_1@dnews> <3b3a1f7a_1@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 27 Jun 2001 15:55:32 -0700
X-Trace: dnews 993682532 209.46.41.66 (27 Jun 2001 15:55:32 -0700)
Lines: 55
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!not-for-mail