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.
示例#1
0
        internal WireBusClient(Socket socket)
        {
            _socket    = socket;
            _semantics = new ConnectionSemantics();

            ReceiveMessages();
        }
示例#2
0
        internal WireBusClient(Socket socket)
        {
            _socket = socket;
            _semantics = new ConnectionSemantics();

            ReceiveMessages();
        }
示例#3
0
        internal WireBusClient(Socket socket, ConnectionSemantics semantics)
        {
            _socket    = socket;
            _semantics = semantics;

            ReceiveMessages();
        }
示例#4
0
		internal WireBusClient(Socket socket, ConnectionSemantics semantics)
		{
			_socket = socket;
		    _semantics = semantics;

		    ReceiveMessages();
		}
示例#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);
 }
示例#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);
 }
示例#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);
	    }
示例#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);
        }
示例#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;
		}
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
        }
示例#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);
	    }