Search the Community
Showing results for tags 'network'.
-
I build an app and i want it to block surfing when a "user" didn't chose, but I can�t find a way to stop the network adapter from c#. I saw and tried a lot of examples and advices from all other the net, but none worked for me. I tried to disabled the adapter- public void DisableNetWork(string interfaceName) { SelectQuery wmiQuery = new SelectQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionId != NULL"); ManagementObjectSearcher searchProcedure = new ManagementObjectSearcher(wmiQuery); foreach (ManagementObject item in searchProcedure.Get()) { if (((string)item["NetConnectionId"]) == "Local Area Connection") { try { item.InvokeMethod("Disable", null); } catch (Exception ex) { String s = ex.Message; } } } } I tried socket bind to another process, so I can block the browsers, I tried disabling the drivers, but nothing worked so far. Do you any have working working idea for me? If you have, Please check if it working on win7 since I understood that there is a different between XP and 7. Great thanks
-
Hello all, I am new to xtremedotnettalk and this is my first thread. I am trying to create a function in vb.net that sends a website header through a socket to the server and returns the response. This is my code. Public Function GetSiteResponse(ByVal IPEndpoint As IPEndPoint, ByVal client As Socket, ByVal header As String) As Byte() client.Connect(IPEndpoint) If client.Connected Then Dim sendbuffer As Byte() = Text.Encoding.ASCII.GetBytes(header) client.Send(sendbuffer, sendbuffer.Length, SocketFlags.None) Dim recievebytes As Byte() = New Byte() {} Do Dim recievebuffer(350) As Byte Dim bytesrecieved As Integer = client.Receive(recievebuffer, recievebuffer.Length, SocketFlags.None) Array.Resize(recievebytes, recievebytes.Length + bytesrecieved) Array.Copy(recievebuffer, 0, recievebytes, recievebytes.Length - bytesrecieved, bytesrecieved) If bytesrecieved < recievebuffer.Length Then Exit Do Loop Return recievebytes Else Return Nothing End If End Function The code doesnt recieve the entire server response. What am i doing wrong? Thanks in advance.