Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (enablestartsnd)
- {
- int port = Zefie.Tools.generateRandomNumber(1024, 65534);
- BackgroundWorker bw = new BackgroundWorker();
- bw.DoWork += new DoWorkEventHandler(
- delegate(object o, DoWorkEventArgs arg)
- {
- while (!Zefie.Tools.isPortAvailable(port))
- port = Zefie.Tools.generateRandomNumber(1024, 65534);
- TcpListener tcp = new TcpListener(new System.Net.IPAddress(16777343), port);
- Socket sock;
- tcp.Start();
- while (tcp.Server.IsBound)
- {
- sock = tcp.AcceptSocket();
- byte[] readbyte = new byte[4096];
- sock.Receive(readbyte, SocketFlags.None);
- byte[] httpheaders = Encoding.ASCII.GetBytes("HTTP/1.0 200 OK\r\n" +
- "Date: " + DateTime.UtcNow.ToLocalTime().ToString() + "\r\n" +
- "Server: Zefie's YouTube Browser Internal HTTP Simulator\r\n" +
- "MIME-version: 1.0\r\n" +
- "Last-Modified: " + DateTime.UtcNow.ToLocalTime().ToString() + "\r\n" +
- "Content-Type: application/octet-stream\r\n" +
- "Content-Length: " + Properties.Resources.intromus.Length + "\r\n\r\n");
- sock.Send(httpheaders);
- sock.Send(Properties.Resources.intromus);
- sock.Close();
- tcp.Stop();
- }
- tcp = null;
- sock = null;
- GC.Collect();
- });
- bw.RunWorkerAsync();
- vlcPlayMedia("http://127.0.0.1:" + port, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement