profile for TheDaveJay at Stack Overflow, Q&A for professional and enthusiast programmers

Thursday, 12 April 2012

Network tracing for an app without code!

There have been times when I needed to dump the incoming and outgoing packets at a network level.

The simplest way and, which is quite efficient was to add System.Diagnostics to you .config file of the application.

Below is an example:

      <source name="System.Net" tracemode="includehex" maxdatasize="1024">
          <add name="System.Net"/>
      <source name="System.Net.Sockets">
          <add name="System.Net"/>
      <source name="System.Net.Cache">
          <add name="System.Net"/>
      <source name="System.Net.HttpListener">
          <add name="System.Net"/>
      <add name="System.Net" value="Verbose"/>
      <add name="System.Net.Sockets" value="Verbose"/>
      <add name="System.Net.Cache" value="Verbose"/>
      <add name="System.Net.HttpListener" value="Verbose"/>
      <add name="System.Net"
    <trace autoflush="true"/>

Below gives a brief description on what the different sources will trace for:


Some public methods of the Socket, TcpListener, TcpClient, and Dns classes


Some public methods of the HttpWebRequest, HttpWebResponse, FtpWebRequest, and FtpWebResponse classes, and SSL debug information (invalid certificates, missing issuers list, and client certificate errors.)


Some public methods of the HttpListener, HttpListenerRequest, and HttpListenerResponse classes.


Some private and internal methods in System.Net.Cache.

No comments:

Post a Comment