asrobins
asked on
vb.net passive tcp port monitoring of another application
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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 ,Buffersiz e)
ServerStream.Write(Buffer, 0,BytesRea d )
EndIf
If ServerTcpClient.Available> 0 Then
BytesRead = ServerStream.Read(Buffer,0 ,Buffersiz e)
ClientStream.Write(Buffer, 0,BytesRea d )
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.
Do
If ClientTcpClient.Available>
BytesRead = ClientStream.Read(Buffer,0
ServerStream.Write(Buffer,
EndIf
If ServerTcpClient.Available>
BytesRead = ServerStream.Read(Buffer,0
ClientStream.Write(Buffer,
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.
ASKER