Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vb.net passive tcp port monitoring of another application

Posted on 2010-09-22
3
Medium Priority
?
1,862 Views
Last Modified: 2012-05-10
I have a vendor-provided VoIP contact center application.  There is a softphone installed on the local PC which communicates with a CTI server application.  The CTI server is accessed via a constant IP address and port.  The port used on the local PC is dynamically assigned.

Using Wireshark, I have documented all of the XML command/responses that occur between the softphone and the CTI application.  What I am trying to do is to reverse-engineer a passive API that sits on the local PC and monitors this softphone-CTI server traffic.  I intend to use this information to record events and drive activities in our CRM application.

I've created a vb.net application that can monitor a port and capture the activity.  The problem is that although I am communicating to the CTI application using a fixed server port, the local TCP port is dynamic, so I don't know which port to listen to.  It is this local port that initiates the conversation.

Is there a way to passively monitor all active ports for traffic going TO a specific IP/port and then use that to determine which local port to monitor for outgoing/incoming traffic?

Thanks.
0
Comment
Question by:asrobins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
andr_gin earned 1500 total points
ID: 33742234
Version1:
You can use WinPcap that is used in Wireshark directly.
http://www.codeproject.com/KB/IP/dotnetwinpcap.aspx

Then you can log all packets that are Ethernet packets and IP packets and tcp packets and go from your computer of any port to a specific computer of a specific port.

Only combining the tcp packets to a continous stream may be complicated.

Version2:
You can build a simple proxy. You listen on the specific port and forward traffic to the same port on the other computer. Then you change the ip of the program on your pc to your local IP.
0
 
LVL 1

Author Closing Comment

by:asrobins
ID: 33768900
Building a simple proxy is a good solution.  Unfortunately, aynchronous socket programming is not altogether that simple!
0
 
LVL 5

Expert Comment

by:andr_gin
ID: 33770010
1.) You can check TcpClient.Available to see, if there is data available in the buffer to read:

Do
    If ClientTcpClient.Available>0 Then
        BytesRead = ClientStream.Read(Buffer,0,Buffersize)
        ServerStream.Write(Buffer,0,BytesRead )
   EndIf
   If ServerTcpClient.Available>0 Then
        BytesRead = ServerStream.Read(Buffer,0,Buffersize)
        ClientStream.Write(Buffer,0,BytesRead )
   EndIf
Loop

2.) Dont try to read and write the same TcpClient/Networkstream in two threads at the same time. This will cause an error.
0

Featured Post

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question