views:

197

answers:

3

I am trying to get an FTP application up and running on Windows Server 2003, before this application was on windows XP professional running with no problem. I have tried googling around for answers, but the only "workaround" I can seem to find on Microsoft’s website didn’t correct the problem (being edit the registry and add a new field DisableRawSecurity with a value of 1(in the correct area). I am debugging this application in VB .Net

The exception: An attempt was made to access a socket in a way forbidden by its access permissions. As requested here is the source code of the sub its hitting the problem on:

Private Sub Listen()
        Try

            ListenerSocket.Bind(LocalEndPoint)
            ListenerSocket.Listen(100)
            While True 
            ListenerSocket.BeginAccept(New AsyncCallback(AddressOf AcceptCallback), ListenerSocket)
            End While
        Catch ex As System.Exception
            Stop
        End Try
        ListenerSocket.Shutdown(SocketShutdown.Both)
    End Sub

Any help would be appreciated.

A: 

Everything in Windows has an Access Control List (ACL). It sounds to me like the user running your application does not have the proper permissions in the ACL to do do what you are asking it to do. I'm not sure how you would go about finding the ACL for a raw socket, but thats where I would start looking.

magnifico
+1  A: 

You might be having a problem because the call to BeginAccept is in an infinite loop. You should only be calling that once until the AsyncCallback is hit, then call EndAccept and BeginAccept again. So essentially you call BeginAccept once to start, and then again after every connection is established.

Eric Nicholson
A: 

Are you even using Raw sockets in your application? If not, then that KB article does not apply, and your exception is due to some other reason.

feroze