示例#1
0
 public SendDirectBuilder SendDirect(TcsPeerConnection tcsRecipientConnection)
 {
     return new SendDirectBuilder(this, tcsRecipientConnection);
 }
示例#2
0
 /// <summary>
 /// Opens a TCP connection and keeps it open. The user can provide the idle timeout, which means 
 /// that the connection gets closed after that time of inactivity. If the other peer goes offline
 /// or closes the connection (due to inactivity), further requests with this connections re-opens 
 /// the connection. This methods blocks until a connection can be reserved.
 /// </summary>
 /// <param name="destination">The endpoint to connect to.</param>
 /// <param name="heartBeatMillis"></param>
 /// <returns></returns>
 public TcsPeerConnection CreatePeerConnection(PeerAddress destination, int heartBeatMillis)
 {
     var tcsPeerConnection = new TcsPeerConnection(destination);
     var taskCc = ConnectionBean.Reservation.CreatePermanentAsync(1);
     taskCc.ContinueWith(tcc =>
     {
         if (!tcc.IsFaulted)
         {
             var cc = tcc.Result;
             var peerConnection = new PeerConnection(destination, cc, heartBeatMillis);
             tcsPeerConnection.Done(peerConnection);
         }
         else
         {
             tcsPeerConnection.SetException(new TaskFailedException(tcc));
         }
     });
     return tcsPeerConnection;
 }