RSS Spy - RSS
Really Simple Syndication
 
Copyright 2003-4 Randy Charles Morin
RSS
<< Previous Main Next >>
Wed, 10 Nov 2004 04:44:51 GMT
RSS Spy

I just wrote a neat little utility for running HTTP GET request. I use it to look at RSS request HTTP headers when RSS users need a little help. The core of the utility is what happens when you click the GO button. Here's open source for you.

System.Uri uri = new Uri(this.textBoxAddress.Text);
System.Net.Sockets.TcpClient client =
new System.Net.Sockets.TcpClient();
client.Connect(uri.Host, uri.Port);
System.Net.Sockets.NetworkStream stream = client.GetStream();
string req = "GET " + uri.PathAndQuery + " HTTP/1.1\r\nHost: " + uri.Host + "\r\n\r\n\r\n";
this.textBox.Text = req;
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(req);
stream.Write(bytes, 0, bytes.Length);
stream.Flush();
for(int i=0;i<100;i++)
{
  
if (stream.DataAvailable)
  
{
     
break;
   }
   System.Threading.Thread.Sleep(100);
}
bytes =
new byte[1024];
System.Text.StringBuilder sb =
new System.Text.StringBuilder();
sb.Append(req);
while (stream.DataAvailable)
{
  
int count = stream.Read(bytes, 0, 1024);
  
if (count == 0)
   {
     
break;
   }
   sb.Append(System.Text.Encoding.UTF8.GetString(bytes, 0, count));
}
this.textBox.Text = sb.ToString();

Ya, it's just a regular old HTTP request, but done at the TCP level so I can dump all the bytes. Don't use it to view the RSS, I use it to get the HTTP headers and stop there. You can download the zipped utility right here. Enjoy!

Reader Comments Subscribe
Type "339":
Top Articles
  1. Unblock MySpace
  2. MySpace
  3. FaceParty, the British MySpace
  4. del.icio.us and sex.com
  5. Blocking Facebook and MySpace
  1. Review of RSS Readers
  2. MySpace Layouts
  3. RSS Stock Ticker
  4. RSS Gets an Enema
  5. Google Reader rejects del.icio.us