tytd-server/RESPONSE.cs

27 lines
659 B
C#

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("");
}
}
}