Article View: borland.public.jbuilder.java.language
Article #7217Re: ?? Prevent starting a Programm twice???
From: Calvin R. Smith
Date: Tue, 03 Jul 2001 19:20
Date: Tue, 03 Jul 2001 19:20
63 lines
3051 bytes
3051 bytes
untill you try to run it on a platform that does not have tcp/ip ;( "Joi Ellis [TeamB]" <joi@aravox.com> wrote in message news:3b3a691c_1@dnews... > 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 write 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:
<3b421b57_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-04!supernews.com!feed.textport.net!out.nntp.be!propagator-dallas!news-in-dallas.newsfeeds.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3b398972$1_1@dnews> <3b39d418_1@dnews> <3b39da80$1_1@dnews> <3b3a1f7a_1@dnews> <3b3a691c_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-07-03 12:28:54 PST From: "Calvin R. Smith" <calvinrsmith@hotmail.com> Newsgroups: borland.public.jbuilder.java.language References: <3b398972$1_1@dnews> <3b39d418_1@dnews> <3b39da80$1_1@dnews> <3b3a1f7a_1@dnews> <3b3a691c_1@dnews> Subject: Re: ?? Prevent starting a Programm twice??? Date: Tue, 3 Jul 2001 13:20:38 -0600 Lines: 65 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 207.201.104.90 Message-ID: <3b421b57_1@dnews> X-Trace: dnews 994188119 207.201.104.90 (3 Jul 2001 12:21:59 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-04!supernews.com!feed.textport.net!out.nntp.be!propagator-dallas!news-in-dallas.newsfeeds.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews