Limiting Bandwidth of your PC using c# - c#

i have check IPv4InterfaceStatistics Class of C# and its seems it display all Information of your Network, from bandwidth download / upload, Packet Sent / Rcvd, and Speed of your LAN,
Upon checking the properties, i have found out that all of the properties are GET only.
Is there a way for us to set / limit the bandwidth of download / upload?
thanks in advance.
PS : I need to create an application that will limit the bandwidth of a PC. Thanks

To do that you will need to create a driver, which is not possible to do in C# (or any other managed language). So at least part of your application will need to be written in C or C++.

Maybe TcpDump
will solve you're issue ,learn how to use it than maybe you can control it from C# as a process ,if Tcpdump can't do that ,that give a try with Wireshark i think Wireshark can be implemented within C#

Related

Transferring binary file over through RS232 using C#

I am looking to transfer a binary file via RS232. I need to do this to 5000 different devices (no joke). I could do them one-by-one through a terminal program but that will take a lot of time.
So, I am writing a C# program that will be able to automate the process. I am looking at using XMODEM protocol and command line parameters to start the process. I have been looking for this for a few hours now and far my results have turned up little. I tried using uCON but that takes some sort of scripting language.
I was wondering if anyone in the community here might know of a solution to transfer a file over RS232 and program it in C#. Whether it is from a protocol (XMODEM) or a program that accepts command line or some other custom solution, doesn't really matter to me.
Ok so I was able to confirm that the code found on the website( ghielectronics.com/community/codeshare/entry/825) was able to work. The issue was was that I did not know how long it would take the computer to transfer the file. I thought that it would be quick. However, after further testing, it actually takes about 30 sec to 1 min depending on the file size.
This C# code snippet allows anyone to transfer a binary file over the Serial Port using the XMODEM protocol. This is done in code and a terminal is not needed which fits the requirements that I needed for the project.

Simpliest method for sniffing network activity

I have used packed inspection program such as WireShark and others and I have observed that most of them relay on the pcap driver.
Recently I stumbled over a source code written in C# witch intercepted traffic in a few lines of code. My questions are:
Is pcap driver or something similar included in .NET ?
Is possible to realize the same sniffing using traditional Windows API ?
If yes what are the drawbacks and why installing pcap is preferred ?
Thank you
Is possible to realize the same sniffing using traditional Windows API ?
Yes you can use the WFP call-out driver
If yes what are the drawbacks and why installing pcap is preferred ?
pcap installs the driver and corresponding user mode dll's , it is easy to use.
Otherwise you have to write ur own filter driver and corresponding user mode code.

Auto-responding to http traffic on local computer

I am looking for a small utility that can perhaps sit in the tray that functions similar to Fiddler's Auto-Responder. I would be willing to write such a utility that supports taking a request and responding with data located in a file containing the response headers/body. I am writing an application is C# that would benefit from such a utility.
If there is no such utility, could someone point me in the right direct for beginning to write such an application? I ask because I figured someone out there probably knows and would point me in the right direction in no time.
Thank you in advanced for your help.
Typically we call this a web server. They listen for web traffic and automatically respond to it with a file, typically a webpage. Apache is cheap. I think MS has a free IIS package too.
You haven't explained what's wrong with simply using Fiddler itself? If you run it using the -quiet command line argument, it sits quietly in the tray.
If you want to write your own application in C#, you can do so using FiddlerCore; see http://www.fiddler2.com/core/ for more details.

How to check what connections a given process has created to the internet

I mean, if you use tools like NetLimiter, they let you know that a given process that connections to IP1, IP2, etc. I am using packet sniffing for my application, but I only need to packet sniff one application, so I'd like to know to what ip addresses that application is connected. Any easy way to do this? I am using a wrapper for WinPCap.
edit: After googling I came to know about the -netstat -bno command. It seems to do what I want, but I'd like to know if there are any specific functions do do it. Otherwise, I'll use this.
edit2: w i n d o w s !
As you suggest, use the windows equivalent;
netstat -abnot
Take a look at GetExtendedTcpTable(), and it's related listed functions. C or C++, I imagine the VB equivs have similar names if your taste is VB.
http://msdn.microsoft.com/en-us/library/aa365928%28VS.85%29.aspx
If you are on Linux you can say "netstat -nap" which will list open network and UNIX domain sockets.
Also you can read info like this from /proc/net/tcp and /proc/net/udp. This page http://linuxdevcenter.com/pub/a/linux/2000/11/16/LinuxAdmin.html should get you started.

C# Non-Windows Remote Desktop

I'd like to create a simple remote desktop application (you can view the screen remotely and interact with it). As a first step, I've tried taking screenshots, 1 per second, compressing them to JPEG and sending them over (without interaction), but I've found that even over LAN this is very slow.
Do you have any hints on how to do this better? Is there C# sample code for projects like this?
You might consider looking at VNC's implementation. VNC is open source and does what you want. I know of an open-source .NET client for VNC:
http://dotnetvnc.sourceforge.net/
Hopefully this will give you some direction for your project.
Just-in-time idea, if you don`t want to use vnc - and want to implement this yourself (for learning, how to invent wheels, for example) - send not full screenshot, but changes from previous - somethins like *.avi format (I forgot details, but something like: one full card, 15 changes, one full card, 15 changes and so on).

Categories

Resources