tytd-server/RESPONSE.cs

27 lines
659 B
C#
Raw Normal View History

2021-06-24 01:10:20 +00:00
using System;
namespace youtube_downloader
{
internal class RESPONSE
{
public RESPONSE(System.IO.Stream strm)
{
this.strm = strm;
}
System.IO.Stream strm;
public void SendResponse(string response)
{
if(strm != null)
{
strm.Write(BitConverter.GetBytes(response.Length), 0, 4);
strm.Write(System.Text.Encoding.UTF8.GetBytes(response), 0, response.Length);
strm.Dispose();
strm = null;
}
}
public void SendResponse()
{
SendResponse("");
}
}
}