Describes the semantics of a WireBus connection. "Peer" refers to the other (non-local) connected party. The semantics of the local WireBus must match the peer WireBus, or messages will not be transmitted properly.
Esempio n. 1
0
        internal WireBusClient(Socket socket)
        {
            _socket    = socket;
            _semantics = new ConnectionSemantics();

            ReceiveMessages();
        }
Esempio n. 2
0
        internal WireBusClient(Socket socket)
        {
            _socket = socket;
            _semantics = new ConnectionSemantics();

            ReceiveMessages();
        }
Esempio n. 3
0
        internal WireBusClient(Socket socket, ConnectionSemantics semantics)
        {
            _socket    = socket;
            _semantics = semantics;

            ReceiveMessages();
        }
Esempio n. 4
0
		internal WireBusClient(Socket socket, ConnectionSemantics semantics)
		{
			_socket = socket;
		    _semantics = semantics;

		    ReceiveMessages();
		}
Esempio n. 5
0
 /// <summary>
 /// Creates a new host configured to listen on the specified IP and port
 /// </summary>
 /// <param name="address">local address</param>
 /// <param name="port">local port</param>
 /// <param name="semantics">the connection semantics</param>
 public WireBusListener(IPAddress address, int port, ConnectionSemantics semantics = new ConnectionSemantics())
 {
     _semantics = semantics;
     _listener  = new TcpListener(address, port);
 }
Esempio n. 6
0
 /// <summary>
 /// Creates a new host configured to listen on the specified IP and port
 /// </summary>
 /// <param name="endpoint">the local endpoint</param>
 /// <param name="semantics">the connection semantics</param>
 public WireBusListener(IPEndPoint endpoint, ConnectionSemantics semantics = new ConnectionSemantics())
 {
     _semantics = semantics;
     _listener  = new TcpListener(endpoint);
 }
Esempio n. 7
0
	    /// <summary>
		/// Creates a new host configured to listen on the specified IP and port
		/// </summary>
		/// <param name="address">local address</param>
		/// <param name="port">local port</param>
        /// <param name="semantics">the connection semantics</param>
        public WireBusListener(IPAddress address, int port, ConnectionSemantics semantics = new ConnectionSemantics())
	    {
	        _semantics = semantics;
	        _listener = new TcpListener(address, port);
	    }
Esempio n. 8
0
	    /// <summary>
	    /// Creates a new host configured to listen on the specified IP and port
	    /// </summary>
	    /// <param name="endpoint">the local endpoint</param>
	    /// <param name="semantics">the connection semantics</param>
	    public WireBusListener(IPEndPoint endpoint, ConnectionSemantics semantics = new ConnectionSemantics())
	    {
            _semantics = semantics;
            _listener = new TcpListener(endpoint);
        }
Esempio n. 9
0
		/// <summary>
		/// Connect to a peer, returning a new bus.
		/// </summary>
		/// <param name="host">the target host</param>
		/// <param name="port">the target port</param>
        /// <param name="semantics">the semantics of the connection</param>
        /// <returns>the bus wrapping the new connection</returns>
		public static WireBusClient Connect(IPAddress host, int port, ConnectionSemantics semantics = new ConnectionSemantics())
		{
			var bus = ConnectAsync(host, port);
			return bus.Result;
		}
Esempio n. 10
0
 /// <summary>
 /// Connect to a peer, returning a new bus.
 /// </summary>
 /// <param name="host">the target host</param>
 /// <param name="port">the target port</param>
 /// <param name="semantics">the semantics of the connection</param>
 /// <param name="timeout">the timeout after which to give up</param>
 /// <param name="token">token used to cancel connection attempt</param>
 /// <returns>the bus wrapping the new connection</returns>
 public static Task<WireBusClient> ConnectAsync(IPAddress host, int port, TimeSpan timeout, CancellationToken token, ConnectionSemantics semantics = new ConnectionSemantics())
 {
     var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     return Task.Factory.FromAsync(socket.BeginConnect, socket.EndConnect, host, port, null)
         .ContinueWith(task => new WireBusClient(socket, semantics))
         .NaiveTimeoutAndCancellation(timeout, token);
 }
Esempio n. 11
0
 /// <summary>
 /// Connect to a peer, returning a new bus.
 /// </summary>
 /// <param name="host">the target host</param>
 /// <param name="port">the target port</param>
 /// <param name="semantics">the semantics of the connection</param>
 /// <param name="token">token used to cancel connection attempt</param>
 /// <returns>the bus wrapping the new connection</returns>
 public static Task<WireBusClient> ConnectAsync(IPAddress host, int port, CancellationToken token, ConnectionSemantics semantics = new ConnectionSemantics())
 {
     return ConnectAsync(host, port, TimeSpan.FromMilliseconds(-1), token, semantics);
 }
Esempio n. 12
0
 /// <summary>
 /// Connect to a peer, returning a new bus.
 /// </summary>
 /// <param name="host">the target host</param>
 /// <param name="port">the target port</param>
 /// <param name="semantics">the semantics of the connection</param>
 /// <param name="timeout">the timeout after which to give up</param>
 /// <returns>the bus wrapping the new connection</returns>
 public static Task<WireBusClient> ConnectAsync(IPAddress host, int port, TimeSpan timeout, ConnectionSemantics semantics = new ConnectionSemantics())
 {
     return ConnectAsync(host, port, timeout, CancellationToken.None, semantics);
 }
Esempio n. 13
0
	    /// <summary>
	    /// Connect to a peer, returning a new bus.
	    /// </summary>
	    /// <param name="host">the target host</param>
	    /// <param name="port">the target port</param>
	    /// <param name="millisecondsTimeout">the timeout in milliseconds after which to give up</param>
	    /// <param name="semantics">the semantics of the connection</param>
	    /// <returns>the bus wrapping the new connection</returns>
	    public static Task<WireBusClient> ConnectAsync(string host, int port, int millisecondsTimeout, ConnectionSemantics semantics = new ConnectionSemantics())
        {
            return ConnectAsync(host, port, TimeSpan.FromMilliseconds(millisecondsTimeout), semantics);
        }
Esempio n. 14
0
	    /// <summary>
	    /// Connect to a peer, returning a new bus.
	    /// </summary>
	    /// <param name="host">the target host</param>
	    /// <param name="port">the target port</param>
	    /// <param name="semantics">the semantics of the connection</param>
	    /// <returns>the bus wrapping the new connection</returns>
	    public static Task<WireBusClient> ConnectAsync(string host, int port, ConnectionSemantics semantics = new ConnectionSemantics())
	    {
	        return ConnectAsync(host, port, CancellationToken.None, semantics);
	    }