miércoles, 7 de abril de 2010

Monitoreo mensajes de Red en aplicaciones .NET

Mecanismo útil para cuando se quiere ver el trafico de red generado por una app .net, por ejemplo para monitorear los comando FTP enviados al servidor, el uso de los Sockets en comunicaciones TCP/IP, ETC


Aquí se puede ver el detalle: http://blogs.msdn.com/dgorti/archive/2005/09/18/471003.aspx

Básicamente es activar el Trace en el archivo de configuración de la aplicación

Lo utilice para depurar la comunicación de una librería FTP y ver como es la comunicación en detalle con el FTP de un AS/400,  lo que me permitió ver cada uno de los comando enviados por la librería

Un ejemplo de cómo queda el log:

System.Net Verbose: 0 : [1540] WebRequest::Create(ftp://127.0.0.1//Omar*.*)
System.Net Information: 0 : [1540] FtpWebRequest#39785641::.ctor(ftp://127.0.0.1//Omar*.*)
System.Net Verbose: 0 : [1540] Exiting WebRequest::Create() -> FtpWebRequest#39785641
System.Net Verbose: 0 : [1540] FtpWebRequest#39785641::GetResponse()
System.Net Information: 0 : [1540] FtpWebRequest#39785641::GetResponse(Method=LIST.)
System.Net Error: 0 : [1540] Exception in the FtpWebRequest#39785641::GetResponse - Unable to connect to the remote server
System.Net Error: 0 : [1540] at System.Net.FtpWebRequest.GetResponse()
System.Net Verbose: 0 : [1540] Exiting FtpWebRequest#39785641::GetResponse()

System.Net Verbose: 0 : [5260] WebRequest::Create(ftp://127.0.0.1//Omar*.*)
System.Net Information: 0 : [5260] FtpWebRequest#57352375::.ctor(ftp://127.0.0.1//Omar*.*)
System.Net Verbose: 0 : [5260] Exiting WebRequest::Create() -> FtpWebRequest#57352375
System.Net Verbose: 0 : [5260] FtpWebRequest#57352375::GetResponse()
System.Net Information: 0 : [5260] FtpWebRequest#57352375::GetResponse(Method=LIST.)
System.Net Information: 0 : [5260] Associating FtpWebRequest#57352375 with FtpControlStream#2637164
System.Net Information: 0 : [5260] FtpControlStream#2637164 - Received response [220 Microsoft FTP Service]
System.Net Information: 0 : [5260] FtpControlStream#2637164 - Sending command [USER orodriguez]
System.Net Information: 0 : [5260] FtpControlStream#2637164 - Received response [331 Password required for orodriguez.]
System.Net Information: 0 : [5260] FtpControlStream#2637164 - Sending command [PASS ********]
System.Net Information: 0 : [5260] FtpControlStream#2637164 - Received response [530 User orodriguez cannot log in.]
System.Net Information: 0 : [5260] FtpWebRequest#57352375::(Releasing FTP connection#2637164.)
System.Net Error: 0 : [5260] Exception in the FtpWebRequest#57352375::GetResponse - The remote server returned an error: (530) Not logged in.

No hay comentarios.:

Publicar un comentario