ln.http/connections/HttpConnection.cs

43 lines
1.1 KiB
C#

// /**
// * File: HttpConnection.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using System.IO;
using ln.types;
using ln.types.net;
using System.Net.Sockets;
using ln.http.listener;
namespace ln.http.connections
{
public class HttpConnection : Connection
{
public TcpClient TcpClient { get; }
public Endpoint RemoteEndpoint { get; }
public HttpConnection(Listener listener, TcpClient tcpClient)
:base(listener)
{
TcpClient = tcpClient;
RemoteEndpoint = new Endpoint(TcpClient.Client.RemoteEndPoint);
}
public override IPv6 RemoteHost => RemoteEndpoint.Address;
public override int RemotePort => RemoteEndpoint.Port;
public override Stream GetStream() => TcpClient.GetStream();
public override void Close()
{
TcpClient.Close();
}
}
}