TcpListener.Start() does not open the port
Posted
by SoMoS
on Stack Overflow
See other posts from Stack Overflow
or by SoMoS
Published on 2010-03-02T10:35:45Z
Indexed on
2010/03/16
17:41 UTC
Read the original article
Hit count: 443
Hello,
I have a class that inherits from the TcpListener, this class Shadows the Start method just to call the base Start() and the base BeginAcceptTcpClient(). From time to time the method is called but the port is not opened (netstat does not show the port open).
The class looks like this
Public Class ExtendedTcpListener
Inherits System.Net.Sockets.TcpListener
Public Shadows Sub Start()
SyncLock (m_stopLock)
MyBase.Start()
MyBase.BeginAcceptTcpClient(AddressOf Me.CompleteAcceptTcpClient, Me)
My.Application.Log.WriteEntry("Extended Tcp Listener started ...", TraceEventType.Verbose)
End SyncLock
End Sub
Any idea on what's happening or how to debug the issue? As the Start() is called without exception I expected to find the port always opened (the log is always written).
Extra information: when the Start method works fine it works each time until app is restarted. When the Start method does not work it won't work again until the app is restarted.
© Stack Overflow or respective owner