I don't think so, no, named semaphores can be used for inter-process
communication on the same box but not across machines.
It's not recommended (for obvious reasons) but you can do a quick & dirty
lock with the file system using File.Open(<name>, FileMode.CreateNew); This
succeeds if the file doesn't exist, throws an IOException if it does. The
first machine to create the file "owns" the lock. On failure you need to
poll. The owner deletes the file when done with the critical section. Since
this isn't a true blocking lock and "blocked" processes aren't on a system
queue there is a potential for starvation if multiple machines are trying to
access the shared resource too frequently.
Better is to use some form of IPC (e.g. .NET Remoting) and establish one
machine as the resource master. All other machines make Remoting calls into
the master to obtain access to the shared resource. The master should use a
separate thread for each caller and can then block callers by waiting on an
internal semaphore that controls access to the resource.
-- TB
[quoted text, click to view] "Amil Hanish" wrote:
> I have several computers that I want to synchronize access to a shared
> resource. Can a semephore do this? If not, what can I use to synch access
> to a shared resource...across computers?
>
> Thanks.
>
> Amil
>
>
Not an expert but IMO it doesn't work this way usually. All requests are
just queued for later processing. Keep in mind that because the fax device
is working doesn't mean network communication are blocked...
Depending on what you are after I would rather suggest a networking group
(or a support for the product tyou are using ?)...
--
Patrice
"Amil Hanish" <amilhanish@hotmail.com> a écrit dans le message de news:
eHJakrYhGHA.3424@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view] > Simple scenario. Let's pretend I have a device like a special intelligent
> fax that is attached to a network. Only one thing can be talking to it at
> a time. If I have several computers that want to use the intelligent fax,
> I someone how to synchronize access it to?
>
> How?
>
> Amil
>
> "Patrice" <scribe@chez.com> wrote in message
> news:O01AT5VhGHA.3376@TK2MSFTNGP03.phx.gbl...
>> Knowing the exact scheme would be better but I've seen something similar
>> (an application able to detect another instance on the network, is this
>> similar ?).
>>
>> IMO it's likely just a network broadcast at startup...
>>
>> --
>> Patrice
>>
>> "Amil Hanish" <amilhanish@hotmail.com> a écrit dans le message de news:
>> %23lkOQ%23RhGHA.1204@TK2MSFTNGP02.phx.gbl...
>>> Assume it's like a smart device plugged into something; it really
>>> doesn't matter. I'm just wanting to know if the Windows OS supports
>>> such a mechanism. 15 years ago I could easily do this on a VAX/VMS
>>> operating system using a cluster event flag (bit flags). I can't
>>> believe a "state of the art" OS can't do this now :-)
>>>
>>> Amil
>>>
>>> "Markus Stoeger" <spamhole@gmx.at> wrote in message
>>> news:ecEJaLQhGHA.4080@TK2MSFTNGP03.phx.gbl...
>>>> Amil Hanish wrote:
>>>>> I have several computers that I want to synchronize access to a shared
>>>>> resource. Can a semephore do this? If not, what can I use to synch
>>>>> access to a shared resource...across computers?
>>>>
>>>> What kind of shared resource is it and how do you access it?
>>>>
>>>> Max
>>>
>>>
>>
>>
>
>