Is it possible for me to disconnect the systems connection to the internet without the need for detecting the network adapter etc.?
I would like to add this functionality to my software but can't find a proper method.
Can anyone shine some light on this.
I am running it through a WPF app.
Thanks
There are many ways to implement your requirement, the best is depend on the platforms which you want support and for other requirements.
You can disable all Network cards.
You can temporary change the routing table.
You can use WFP (Windows Filtering Platform see http://msdn.microsoft.com/en-us/library/aa366510.aspx) to block connection of the level of firewall, but without direct usage of the firewall.
I am sure that it is not the full list of possible ways. I know no simple .NET API which can you use.
You should be careful to be sure that after the end of your application the computer can work as before.
Related
A friend likes to limit his applications to a use a certain bandwidth-limit. Seen as he doesn't have the widest connection and - for example - not every application that downloads/uploads has the ability to throttle/limit their downloads/uploads (Like Steam or a torrent downloader.). So he was wondering if I could maybe put something together since I fiddle around with WinForms often. I recommended NetLimiter and NetBalancer, but I was curious as to whether I could make this in C# myself.
I have searched the web and found some decent solutions as to throttling in an application itself but as to throttling applications outside of the current application you have the source code of, I haven't been able to find anything that would help me understand how to program this from scratch.
Do any of you know how I'd go about throttling other applications? Would I have to write my own network interface and have Windows reroute traffic through that?
Thank you for your time.
EDIT: Seen as the first comment tells me I'm at the wrong address with C#, I rephrased my question in the hopes of a better way to get an answer.
I want to be able to pull in the error log from BIOS across a network. Looking at Win32_BIOS in MSDN I did not see anything defining the error log. Would love to do this in C# with WMI, but am open to suggestions. Is it possible?
Win32_BIOS does not have a property (don't know if that is the right term) that contains the BIOS error log. Is there a library, API, etc. that I can use to pull this information locally or from the network?
Generally, it is not possible to do this in such a way that will apply across a spectrum of motherboards as the requisite commands and interfaces will be hardware specific.
Some motherboards may contain an API call that will allow this, however, I have never come across one myself.
I've been asked to research approaches to deal with an app we're supposed to be building. This app, hypothetically a Windows form written in C#, will issue commands directly to the server if it's connected, but if the app is offline, the state must be maintained as if it was connected and then sync up and issue data changes/commands to the server once it is connected.
I'm not sure where to start looking. This is something akin to Google Gears, but I don't think I have that option if we go a Winform route (which looks likely, given that there are other functions the application needs that a web app couldn't perform). Is the Microsoft Sync framework a viable option? Does Silverlight do anything like this? Any other options? I've Googled around a bit but would like the community input on what's best given the scenario.
The Microsoft Sync Framework definitely supports the scenario you describe, although I would say that it's fairly complicated to get it working.
One thing to understand about the Sync Framework is that it's really two quite distinct frameworks shipping in the same package:
Sync Framework
ADO.NET Sync services v. 2
The ADO.NET Sync services are by far the easiest to set up, but they are constrained to synchronizing two relational data stores (although you can set up a web service as a remote facade between the two).
The core Sync Framework has no such limitations, but is far more complex to implement. When I used it about six months ago, I found that the best source to learn from was the SDK, and particularly the File/Folder sync sample code.
As far as I could tell, there was little to no sharing of code and types between the two 'frameworks', so you will have to pick one or the other.
In either case, there are no constraints on how you host the sync code, so Windows Forms is just one option among many.
If I understand correctly, this doesn't sound like an actual data synchronization issue to me where you want to keep two databases in sync. it sounds more like you want a reliable mechanism for a client to call functions on a server in an environment where the connection is unstable, and if the connection is not present at the time, you want the function called as soon as the connection is back up.
If my understanding is right, this is one option. if not, this will probably not be helpful.
This is a very short answer to an in-depth problem, but we had a similar situation and this is how we handled it.
We have a client application that needs to monitor some data on a PC in a store. When certain events happen, this client application needs to update our server in the corporate offices, preferably Real-Time. However, the connection is not 100% reliable, so we needed a similar mechanism.
We solved this by trying to write to the server via a web service. If there is an error calling the web service, the command is serialized as an XML file in a folder named "waiting to upload".
We have a routine running in our client app on a timer set for every n minutes. When the timer elapses, it checks for XML files in this folder. If found, it attempts to call the web service using the information saved in the file, and so on until it is successful. Upon a successful call, the XML file is deleted.
It sounds hack-ish, but it was simple to code and has worked flawlessly for five years now. It's actually been our most trouble-free application all-around and we've implemented the pattern elsewhere successfully
I want to create an application which creates a VPN between some endpoints, something like hamachi and i do not have a starting point. I haven't found any resource to explain how to create such a network application.I want to use c# because i have some experience with it.
I really need some help, anything that can put me on the right way. Thanks.
There are a number of distinct elements of VPN software that you'll have to figure out:
What technology/standard will your program use to provide the privacy? Some common ones are IPSEC, L2TP, PPTP, SSH, and SSL. Web searches ought to turn up rich information (including RFCs) on all of these. If you're doing this as a learning exercise, rather than needing actual security, you could also design your own.
Are you implementing a client, a server, or both?
What operating system(s) will you support? This affects what you need to do to convince it to route packets through your application.
Do you plan to interoperate with software implementing some standard?
You might want to take a look at SSH tunneling and see if it solves your needs.
So my company stores alot of data in a foxpro database and trying to get around the performance hit of touching it directly I was thinking of messaging anything that can be done asynchronously for a snappier user experience. I started looking at ActiveMQ but don't know how well C# will hook with it. Wanting to hear what all of you guys think.
edit : It is going to be a web application. Anything touching this foxpro is kinda slow (probably because the person who set it up 10 years ago messed it all to hell, some of the table files are incredibly large). We replicate the foxpro to sql nightly and most of our data reads are ok being a day old so we are focusing on the writes. plus the write affects a critical part of the user experience (purchasing), we store it in sql and then just message to have it put into foxpro when it can. I wish we could just get rid of the foxpro, unfortunately the company doesn't want to get rid of a very old piece of software they bought that depends on it.
ActiveMQ works well with C# using the Spring.NET integrations and NMS. A post with some links to get you started in that direction is here. Also consider using MSMQ (The System.Messaging namespace) or a .NET based asynchronous messaging solution, with some options here.
MSMQ (Microsoft Message Queueing) may be a great choice. It is part of the OS and present as an optional component (can be installed via Add/Remove Programs / Windows Components), meaning it's free (as long you already paid for Windows, of course). MSMQ provides Win32/COM and System.Messaging APIs. More modern Windows Communication Foundation (aka Indigo) queued channels also use MSMQ.
Note that MSMQ is not supported on Home SKUs of Windows (XP Home and Vista Home)
Its worth mentioning that the ActiveMQ open source project defines a C# API for messaging called NMS which allows you to develop against a single C# / .Net API that can then use various messaging back ends such as
ActiveMQ
MSMQ
TibCo's EMS
any STOMP provider
any JMS provider via StompConnect
You may want to look at MSMQ. It can be used by .NET and VFP, but you'll need to rewrite to use them. Here's an article that tells you how to use MSMQ from VFP. https://learn.microsoft.com/en-us/previous-versions/visualstudio/foxpro/ms917361(v=msdn.10)
Sorry if this isn't what you are asking for...
Have you considered some sort of cache behind the scenes that acts a bit like the "bucket system" when using asynchronous sockets in c/c++ using winsock? Basicly, it works by accepting requests, and sends an immediate response back to the web app, and when it finally gets around to finding your record, it updates it on the app via AJAX or any other technology of your choice. Since I'm not a C# programmer I can't provide any specific example. Hope this helps!
Does the Fox app use .CDX indexes? If so, you might be able to improve performance by adding indexes without needing to change any program code. If it uses .IDX indexes, though, the change would have to be done in the actual app.
As the problem is with writes, I would look more towards >removing< any unneeded indexes on the tables. As is common in RDBMS, every index on a FoxPro table slows down a write operation as the indexes need to be updated, and as you aren't reading directly from (or presumably directly querying) the table you shouldn't need very many indexes. You might also want to look at any triggers or field rules on the tables as they may be slowing down the write operation. Be sure your referential integrity is still preserved, though..