Example #1
0
 private Socket Connect()
 {
     while (true)
         try
         {
             Socket _Socket = new TcpClient(host, port).Client;
             string s = Res.get.Replace("_host_", host + ":" + port).Replace("_page_", page);
             _Socket.Send(s);
             _NetworkStream = new NetworkStream(_Socket);
             _NetworkStream.ReadTimeout = 40000;
             string s2 = _NetworkStream.Cut("\r\n\r\n").ToStr();
             name = Regex.Match(s2, "icy-name:(.+)\r").Groups[1].Value;
             blocksize = int.Parse(Regex.Match(s2, @"icy-metaint:(.+)\b").Groups[1].Value);
             return _Socket;
         }
         catch { }
 }
Example #2
0
        public void Send(object o)
        {
            i++;
            string s = (string)o;
            try
            {

                Socket _Socket = new TcpClient("192.84.196.226", 8080).Client;
                using (NetworkStream _NetworkStream = new NetworkStream(_Socket))
                {
                    _NetworkStream.Write(string.Format(Res.proxy, s));
                    string s2 = _NetworkStream.Cut("\r\n").ToStr();
                    s.Trace(s2.Trim());
                    if (s2 == _ok)
                    {
                        if (!_ListA.Contains(s)) _ListA.Add(s);
                        _ListA.Flush();
                        "success".Trace();
                    }                
                _Socket.Close();
                }
            }
            catch (IOException) { "err".Trace(); }
            catch (SocketException) { "connerr".Trace(); }
            i--;
        }