Cross-Platform Network Applications with Mono
Compiling C# programs is done by way of the mcs compiler. MonoBlog is compiled with this command:
mcs -r gtk-sharp.dll -r glade-sharp.dll \ -r XmlRpcCS.dll -r glib-sharp.dll monoblog.cs
The -r option indicates a resource the program needs; here, we simply need to specify which libraries MonoBlog uses. This produces a compiled bytecode file called monoblog.exe. To run the program, we need to run the Mono CLR with this file as a parameter:
Now, having developed the program on Linux, we can run the program on Windows or Mac OS X with a minimum of fuss. Simply copy monoblog.exe, monoblog.exe.config and monoblog.glade files to the other platform and run them using the Mono CLR, as shown above.
Figures 3, 4 and 5 show MonoBlog running on Linux, Windows and Mac OS X machines, respectively. No code has to be changed; the program works as is, as long as all the libraries MonoBlog uses are present.
Hopefully, this article has demonstrated how Mono and C# can be used to create cross-platform applications quickly and easily. You can develop on one platform and be assured that the program can run on any platform that runs Mono and the GTK libraries. The MonoBlog program itself is ripe for further experimentation. Some possible areas for improvement are extra formatting options, more detailed error reporting, using the GtkHTML# bindings to create an HTML preview window, and further implementation of the MetaWeblog API, such as adding the ability to delete posts from a Weblog.
Resources for this article: /article/7557.
Ian Pointer is an unemployed Computer Science graduate in the UK. He can be reached at firstname.lastname@example.org.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Devuan Beta Release
- May 2016 Issue of Linux Journal
- EnterpriseDB's EDB Postgres Advanced Server and EDB Postgres Enterprise Manager
- The US Government and Open-Source Software
- The Humble Hacker?
- BitTorrent Inc.'s Sync
- Tech Tip: Really Simple HTTP Server with Python
- Open-Source Project Secretly Funded by CIA
- The Death of RoboVM
- New Container Image Standard Promises More Portable Apps
In modern computer systems, privacy and security are mandatory. However, connections from the outside over public networks automatically imply risks. One easily available solution to avoid eavesdroppers’ attempts is SSH. But, its wide adoption during the past 21 years has made it a target for attackers, so hardening your system properly is a must.
Additionally, in highly regulated markets, you must comply with specific operational requirements, proving that you conform to standards and even that you have included new mandatory authentication methods, such as two-factor authentication. In this ebook, I discuss SSH and how to configure and manage it to guarantee that your network is safe, your data is secure and that you comply with relevant regulations.Get the Guide