WCF singleton service + callbacks

  • Thread starter Thread starter sandrofurlan
  • Start date Start date
S

sandrofurlan

Hi there,
I've a wcf singleton service and I need to send callbacks to all
connected clients. At the status only the last connected client
receive callbacks.

This is the code:

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.Single, _
ConcurrencyMode:=ConcurrencyMode.Multiple)> _
Public Class CalculatorService
Implements ICalculator

Private callback As ICalculatorCallback = Nothing

public sub New()
'open my USB comm object
comm.open(myusbdevice)
'start secondary thread for receiving data from USB device
threadListener = New System.Threading.Thread(AddressOf
Listener)
threadListener.IsBackground = True
threadListener.Start()
end sub

public function Connect() as Boolean
callback = OperationContext.Current.GetCallbackChannel(Of
ICalculatorCallback)()
return true
end sub

protected sub Listener

do while threadlistener isnot nothing

......

callback.result(myparams)

.....

loop

end sub

I think i've got to store connected clients somewhere but I don't know
how.
Please help me!
thanks

end class
 
Back
Top