andrew andrew - 15 days ago 4
C# Question

an attempt was made to access a socket in a way forbbiden by it's access permissions. why?

private void StartReceivingData(string ipAddress, int iPort)
if (!_bContinueReciving)
//initializeMainSocket(ipAddress, iPort);
_mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);//<------HERE IS RAISED THE EXCEPTION
_mSocket.Bind(new IPEndPoint(IPAddress.Parse(ipAddress), iPort));
// _mSocket.Bind(new IPEndPoint(IPAddress.Loopback, iPort));
_mSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, true);
_mSocket.IOControl(IOControlCode.ReceiveAll, new byte[4] { 1, 0, 0, 0 }, new byte[4] { 0, 0, 0, 0 });
//var 1
_mSocket.BeginReceive(_buffReceivedData, 0, _buffReceivedData.Length, SocketFlags.None,
new AsyncCallback(OnReceive), null);
_bContinueReciving = false;
catch (Exception exception)

I don't understand worked and now it doesn't. could someone help me?
i am streaming with vlc, and i wan't to receive the packets, do some reports, and then restream local to a player


Most likely the socket is held by some process. Use netstat -o to find which one.