I am working on a project that will run on a small linux platform. All applications on the system must be written in c# that will be executed via mono. But that is causing me some problems with the network information port. All the examples I have been able to find on the topic on the internet is for .net, and it seems that the WlanInterface module is not implemented in mono.
So the simple question is then, how do I get information such as ssid, rssi, available APs, and its like in mono on linux? Is there a simple way, or do I have to write a service object in e.g. c++ or java to get the information?
damn, not what I was hoping to hear :)
Anyway, I found another solution I will try to pursue. Since the machine has got gnome on it, hijacking the information from the network manager via dbus could be the solution. This might also be a good idea, since I would like to receive an event when connection is lost.
I would still like to hear comments both on this idea, MarkR's idea and any other alternatives.
You can invoke the command line utilities and parse their output via a pipe or something e.g.
iwconfig
iwlist
etc which will ship with a wifi-enabled Linux system.
Related
Is There any way to do following in C#.NET or JAVA,
Get list of files from specific directory of Another pc having solaris OS and transfer file using SCP to another pc which have also solaris OS.
Actually i am thinking about creating front-end in asp.net to transfer backup from Live to backup server and get information about backup.
I even this is possible or not, but I wan't to clear my confusion on this.
Please give me your suggestion.
C# or any other .NET language is specific for Windows and won't run on anything but Windows. So forget about .NET languages. For this type of task I would definitely use Java if you insist on using a programming language at that level.
From Java you can use JSch library. It can do SCP from within Java. Here's is one example.
However I must say that most people that are familiar with Unix/Linux would probably simply do this task from within a scripting environment. Heck it can be done from Bash if you like.
Regardless of your choice of tool/prg.language you'll also have to decide if your doing PUSH or PULL. It seems from your posting that you are most keen on doing a PULL. There's no right or wrong answer on PUSH vs PULL.
I'm trying to make a simple concept demonstration app the code of which I may use in the future. Specifically I want to have an iPhone running an app that sends XML data to a Bonjour service. I already have an Objective-C app that runs on mac and does this, but I need to make one on Windows with a strong preference for Mono Zeroconf because the project may involve the use of the Mono framework later on.
To this end I need a working sample of using the Mono Zeroconf library. The examples I could find on the website are not sufficient. ALl that they allow me to do is to register a service, but nothing after that. Specifically I have this:
RegisterService service = new RegisterService();
service.Name = "AirControlServer";
service.RegType = "_http.tcp.";
service.ReplyDomain = "local.";
service.Port = 3689;
service.Register();
And now I have absolutely no clue what to do. If someone could link me to some sample code or something, that would be really nice.
Thank you.
The Zeroconf is only used for announcing or discovering. That is, if you have some kind of service (for example, http server), you can use Mono.Zeroconf to announce it. The provided service is beyond the scope of the library, you have to provide it as usual. In other words, you can use the library to either answer questions like "What is the IP address of my service provider?" or announce such services ("Tell them that X.X.X.X has a service on port YY).
For the announcing part, you've already found the example, you can also look at this question. For the discovering, look here (at the "Listen for and resolve services" part).
In the Mono.Zeroconf source code, there is a sub-directory MZClient which contains good example code ZeroconfClient.cs for both publishing and browsing.
I have a Visual C# project on my computer and I would like my users to be able to interact with it through a web browser. I've done my research, and I understand that I will probably use CGI to do this.
However, while I have been able do this with .pl and .cpp files, i can't figure out how to to it with C sharp (.cs) files. Can anyone explain how I would do this?
EDIT: If there is an alternate solution wherein the webpage communicates my C# program as a back-end program, that works, too.
UPDATE: After cancelling with my hosting provider and setting up a home-based web server (windows), I finally got the C# file to run as CGI. Thanks to everyone for your help!
You've got to give us some context ... why wouldn't asp.net be an option? If you simply don't want to run in the context of IIS, you could simply write a windows service (and expose WCF services, or even raw sockets if that's what you need).
edit: in response to the recent comment about the server being UNIX, you can use MONO to run .net code on that server: http://www.mono-project.com/Main_Page
You can either use something like mod_mono or if you'd prefer something different, you can look at manos de mono
First, I assume you have the Mono project compiler and runtime environment installed on your system.
CGI takes place entirely via standard input and standard output. (This is one reason why it is so easy to write CGI scripts in Perl, Python, Ruby, etc. You just start reading standard input as usual, parse the variables, and write whatever output you want the client to see.) Don't forget that you're responsible for the entire header, including Mime type.
If you need something that performs faster than CGI's constant fork(2)+execve(2) re-starting your CLR over and over again, you can implement the FastCGI protocol (at least, I didn't see a C# implementation on the Wikipedia page) yourself using sockets and start your CLR once only, so you have some reasonable performance. (I seem to remember Nat being passionate about the Mono process start time being "fast enough" to use it for interactive commands, so perhaps a lightly-loaded server won't have any trouble with plain old CGI interface.)
I am attempting to implement some additional statistics gathering in a C# server application - I have about 20 or so variables I'd like to be able to report to network monitoring tools; so I am assuming (hopefully correctly) that SNMP is the correct way to go.
There are however two problems:
The application is an open source server that cant include proprietary components, and
It needs to run on Mono under *nix environs as well as Windows via .NET.
The "#SNMP" library at http://sharpsnmplib.codeplex.com/ appears to be a promising solution - but there are no samples I can find; and my knowledge of SNMP is lacking.
Does anyone here have any (quick) examples of reporting data via SNMP? (ideally using a library under the LGPL, X/MIT, BSD or Zlib licenses)
Help much appreciated
Edit:
The problem appears to be a lack of libraries capable of acting as SNMP servers, if anyone is aware of any - this would probably solve the problem nicely.
Edit #2:
Basically I'm looking for a SNMP server library or sample reference implementation.
As the author :) I suggest you check out TestAgent sample. It can send out TRAP or INFORM messages to the IP address you specify.
Note that this is a tiny sample, which does not reveal all powers of SNMP.
#SNMP source comes with some samples (they're actually tests, but one can have an idea about how it works).
Another thing you could try is send your snmp queries calling directly the snmpget executable with the Process class. It's not the best way, but it could work (I've used this kind of approach with another language).
I am writing an application where all the request to the internet should go from it like in firewall. so that i can block the request for a particular website. In my case the program will be running on the same machine. I have tried the promiscous method but using that we can only capture all the packets comming and going from the machine,
The easiest way to do it is probably to write a Layered Service Provider (LSP). There is an example in the Microsoft SDK on developing LSPs as well. Not as secure as a driver type firewall setup, but a lot easier to implement.
There's "probably" a way to do it with C#, but I have never tried it. Something to look into. If not then just create a native DLL with C/C++ that implements the LSP then have it communicate with your app.
You have to insert your code in the TCP/IP stack, which, if I understand correctly, requires a windows driver.
C# cannot compile native windows drivers, so you'll need to use a library or DLL to implement at least part of your functionality. Look for solutions using C++.
-Adam