Tag Archives: .NET

.NET Sockets – An Event-based Asynchronous TCP Framework and HTTP Server

Update November, 2014: This project has evolved from a generic TCP communications framework into an HTTP web server capable of hosting WordPress, called Rapid Server.

.NET Sockets is a client/server communication system utilizing asynchronous .NET sockets via an Event-based Asynchronous Pattern (EAP) on top of an IAsyncResult Pattern with thread pools (I/O completion ports) and a binary packet-based TCP communications for maximum concurrency, capacity, performance and scalability.

Visit the Github repo for progress. Benchmarks can be found here and here.

Benchmarking Node.js, Apache and .NET Sockets

abThe preliminary benchmark started out simple enough. In the client app, I set up a for…loop with a start/end timer to see how many requests the server app could handle within a given time period. Surprised by the results, I decided to re-tool the server app into a proper HTTP web server that could handle a GET request and return an HTTP 200 OK with “hello world” to the client. The results didn’t change much from before (still very promising) so I decided to install Node.js in Windows 7 and run a more thorough benchmark using ApacheBench, comparing against Node.js and Apache.

This is a simulated benchmark which should not be taken as a conclusive real-world test. However, the results are fascinating and worth looking into further. Continue reading

.NET Sockets – Preliminary Benchmarks

Concurrency testing started out simple enough – launch multiple instances of the client app and see how well the server can handle them all. First I used a simple DOS script that would launch 10 clients each time:


for /l %%i in (0,1,10) do (start AsyncSocketClient.exe -port 8989 -address 127.0.0.1)

Launching the client app this many times turns out to be a bad idea since each instance of the app consumes about 8 MB of memory, but even so, the server can handle 100 clients all connecting at once just fine:

100-clients

Upon further review, the SendMessageToClient function or the callback in the UI thread isn’t optimized properly. A stress test has been built into the client app which creates 100 or 1000 sockets and connects them to the server immediately (no sleep), simulating a massive influx of clients. This heavy load experiment piqued my interest, so I had a look into the SendMessageToClient function to see if it could be optimized. In the callback, we are updating a listbox and textbox on the server’s UI thread. Avoiding these two updates causes the server to perform much better, and that’s fine because we can omit the Forms-based UI and simply write strings to the console, as most servers do.

We can clearly see that the server is able to handle over 10,000 connections without a hiccup:

13000-clients
Continue reading

Nest (Your PC on the Internet)

Nest

Access your files from anywhere.

If you’re like most people who have accumulated a large collection of personal photos, music, and videos on your computer at home, but wish you had access to everything whenever and wherever you are, then Nest might be for you!

Or maybe you’re a business owner who’s frequently out of the office. Install Nest on your workstation. Leave town. Open Nest on your smartphone. Start browsing your files!

Your computer + Nest = Your computer on the internet

Or to put it another way, Nest turns your computer into a “Personal Cloud“where you can access your files remotely via a web browser from almost any device, much like the new cloud music players, only you host all of your own files.

In a nutshell, Nest is…

  • A remote file browser
  • A remote music streamer with playlist support
  • A remote image viewer with slideshow support
  • A remote document viewer

Don’t allow big corporations to store and own your intellectual property!

Continue reading

Perry’s ID3 Tag Library

ID3v2Perry’s ID3 Tag Library is a free open-source ID3v1 and ID3v2 tag parsing utility for MP3 files that has been tested to work with Visual Studio, VB.NET, ASP.NET, Visual Basic for Applications and VBScript.

Use the library as a reference in your own Visual Studio project to parse ID3 tag data embedded in MP3 files, or use the ActiveX control to give familiar Microsoft Office products such as Word and Excel the ability to parse ID3 tags. This library is useful for anyone looking to implement ID3 tag capabilities in their own custom solutions and applications.

You might be interested in Perry’s ID3 Tag Viewer which is a full implementation of the current ID3 Tag Library version.

Tag Writing is currently in the works as of May 2012!

The ID3TagLibrary is pretty simple to use:


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  ' create an mp3 object from a file on the hard drive
  Dim mp3 As New ID3TagLibrary.MP3File("C:\song.mp3")
  ' put the mp3's title into a label control
  Label1.Text = mp3.Title
  ' put the mp3's artwork (if any!) into a picturebox control
  PictureBox1.Picture = mp3.Tag2.Artwork
End Sub

Continue reading

Perry’s Reverb Rhythm Calculator

Screenshot 1Perry’s Reverb Rhythm Calculator is a utility for musicians (as well as mixing and mastering engineers) that will compute reverb pre-delay and decay values (in milliseconds) for you to use with your reverb plugins. These values are specifically synchronized to the rhythm of a chosen Tempo (BPM), and an offset slider allows for slight adjustments to the output.

Continue reading

How to Convert a System.Drawing.Image to an IPictureDisp with Alpha Transparency

Anyone who wants to build a professional looking add-in for Microsoft Outlook knows that it’s important to make their add-in appear flush/stock/standard/factory, which means implementing the add-in functionality directly into the native Outlook interface via the toolbar/ribbon/menu/property pages/etc. An important part of this is understanding how to use IPictureDisp, because this is the only image type that Outlook will allow you to use for CommandBar controls.

Continue reading

GO Detach for Outlook

Screenshot 1Introducing GO Detach for Outlook. This small add-in lets you bulk save e-mail attachments (or body text) from Outlook to your hard drive. Whether you use it to free up space in your mailbox or personal folder (PST) file, GO Detach will boost your productivity by automating several repetitive tasks at once. For example, GO Detach can save multiple attachments from multiple emails into separate folders based on certain criteria of your choice. Be sure to check out the screenshots.

Continue reading