Exemplo n.º 1
0
 //
 // Initializes a new instance of the TcpListener class that listens on proxy
 //
 public TcpListener(SocketAddress endpoint)
 {
     Endpoint = endpoint;
     Active   = false;
     Server   = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 }
 /// <summary>
 /// Constructor for broadcast link object
 /// </summary>
 /// <param name="socket"></param>
 /// <param name="proxy"></param>
 /// <param name="remoteId"></param>
 /// <param name="localAddress"></param>
 /// <param name="peerAddress"></param>
 internal BroadcastLink(BroadcastSocket socket, INameRecord proxy,
                        Reference remoteId, SocketAddress localAddress, SocketAddress peerAddress) :
     base(socket, proxy, remoteId, localAddress, peerAddress)
 {
 }
 //
 // Connect async
 //
 public Task ConnectAsync(SocketAddress endpoint) =>
 Socket.ConnectAsync(endpoint);
 //
 // Connect async
 //
 public void Connect(SocketAddress endpoint) =>
 Socket.Connect(endpoint);
 //
 // Connect async
 //
 public Task ConnectAsync(SocketAddress endpoint, CancellationToken ct) =>
 Socket.ConnectAsync(endpoint, ct);
Exemplo n.º 6
0
 //
 // Begin sending on unconnected socket to named host
 //
 public IAsyncResult BeginSend(byte[] datagram, int bytes, SocketAddress endpoint, AsyncCallback requestCallback, object state) =>
 TaskToApm.Begin(SendAsync(datagram, bytes, endpoint), requestCallback, state);
Exemplo n.º 7
0
 //
 // Send async on unconnected socket to host
 //
 public Task <int> SendAsync(byte[] datagram, int bytes, SocketAddress endpoint) =>
 Socket.SendToAsync(datagram, bytes, endpoint);
 public override Task <int> SendAsync(ArraySegment <byte> buffer, SocketAddress endpoint,
                                      CancellationToken ct)
 {
     throw new NotSupportedException("Cannot call send on server socket");
 }
 public override Task ConnectAsync(SocketAddress address,
                                   CancellationToken ct)
 {
     throw new NotSupportedException("Cannot call connect on server socket");
 }