public void CreateUser(string userName, bool propagate) { PeerGroupID gid = this.netPeerGroup.PeerGroupID; PipeID pipeid = IDFactory.NewPipeID(gid); PipeAdvertisement adv = new PipeAdvertisement(); adv.SetPipeID(pipeid); adv.Type = (propagate ? "JxtaPropagate" : "JxtaUnicast"); adv.Name = "JxtaTalkUserName." + userName; adv.Desc = "created by JXTA .NET"; discovery.Publish(adv); }
public OutputPipe ConnectToUser(string userName) { PipeAdvertisement adv = GetUserAdv(userName, 1 * 5 * 1000 * 1000); if (adv != null) { OutputPipe op = pipeservice.CreateOutputPipe(adv, 30 * 1000); if (op == null) { textWriter.WriteLine("peer not found."); return(null); } _outputPipe.Add(userName, op); return(op); } return(null); }
public void LoginUser(string userName, PipeMsgListener talkMessageListener) { PipeAdvertisement adv = GetUserAdv(userName, 30 * 1000 * 1000); if (_userDictionary.ContainsKey(userName) == true) { textWriter.WriteLine("User " + userName + " is already logged in!!!"); return; } if (adv != null) { InputPipe inputPipe = pipeservice.CreateInputPipe(adv, talkMessageListener); // Releasing of these objects are prevented by this container. _userDictionary.Add(userName, inputPipe); } else { textWriter.WriteLine("Cannot retrieve advertisement for " + userName); } }