Jump to content
xisto Community

prashant144

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by prashant144


  1. Hi Zakuluka,

    I am not tested in unix.
    If you have problem in capturing port then just make unique port like 99999 something like that
    which nobody use.


    thanks

    I've used the lock method described by Prashant. The only problem is that the file has to be deleted manually if the application crashes without removing the lock.
    The benefit is that this technique works on every operating system and platform, with any java toolkit. I had a problem with capturing certain ports on unix, especially with certain firewalls running in the background.

    Regards,

    z.



  2. Hi,

    Its very nice yar.
    I also want the same thing but i use some different technique.

    1. I make a ServerSocket object and capture a port say 1111
    If again on another instance you are trying to make a same object then it
    is giving you error because your 1111 port is captured by 1st instance.

    So easily you can track and throw a error to user.
    Its very simple and effective too.

    Just follow the link for all codes.

    Single instance aaplicaion in JAVA

    2. Another method is make a txt file with one instance and delete while exiting.
    On next time just check if file is existing then any instance is running.
    And you can track the error.
    For being effective do not create file in C partition.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.