Quantcast
Viewing all articles
Browse latest Browse all 27408

VS 2008 TCPListener throwing exception 10048

I'm trying to duplicate a program's feature, but have it perform a different set of tasks.

What's going on is that Program A is communicating to Program B, which is typically performed over a closed LAN (you push a button in Program A - Program B changes the state of a the appropriate label, which is NOT it's only function/purpose). Program B IS receiving instructions from Program A.

If I use Micro$oft's TCPView, there is a connection between the two.

However, and for whatever reason, neither Wireshark nor Micro$oft Network Monitor 3.4 are showing ANY traffic between the two programs, even with all filters disabled.

I'm wanting to capture the data-stream between the two for analysis because it's supposedly using a proprietary protocol. Soooo, I wrote a quickie set of instructions to aid me in that with my program, but it's throwing an exception 10048 error ("Only one usage of each socket address (protocol/network address/port) is normally permitted"). I've turned on the service Net.TCP, and still get this error.

TCPView reports...
Program A:
Remote Port: 9000
Local Port: 3822

Program B:
Remote Port: 3822
Local Port: 9000

My computer is on 192.168.1.174, if that helps any.

I know it should be possible to passively listen in on this, I just don't know how to do it.
Anyone have a better solution?

vb.net Code:
  1. Imports System
  2. Imports System.Xml
  3. Imports System.IO
  4. Imports System.Net
  5. Imports System.Net.Sockets
  6. Imports System.Text
  7. Imports Microsoft.VisualBasic
  8.  
  9.   Dim listener As Net.Sockets.TcpListener
  10.   Dim listenThread As Threading.Thread
  11.  
  12. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  13.     'Other code for different form calls here
  14.     listener = New Net.Sockets.TcpListener(Net.IPAddress.Any, 9000)
  15.     listener.Start()
  16.     listenThread = New Threading.Thread(AddressOf DoListen)
  17.     listenThread.IsBackground = True
  18.     listenThread.Start()
  19. End Sub
  20.  
  21. Private Sub DoListen()
  22.   Dim sr As IO.StreamReader
  23.  
  24.   Do
  25.     Try
  26.       Dim client As Net.Sockets.TcpClient = listener.AcceptTcpClient
  27.       sr = New IO.StreamReader(client.GetStream)
  28.       MessageBox.Show(sr.ReadToEnd)
  29.       sr.Close()
  30.  
  31.     Catch ex As Exception
  32.       MessageBox.Show(ex.Message)
  33.     End Try
  34.   Loop
  35.  
  36. End Sub

Thanks,
-Shooter

Viewing all articles
Browse latest Browse all 27408

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>