An Original Idea

because all great software begins with an original idea

Archive for August 9th, 2007

Victory for all Media Center Users in Australia

Posted by anoriginalidea on August 9, 2007

image

I believe a problem with Media Center adoption in Australia has been access to a good free Electronic Program Guide.   In other countries it’s tkan for granted, but for MCE (and other Media Center) users, getting an EPG becomes a real drama.    Undoubtedly the EPG functionality is an essential piece of the Medic Center value proposition.

Apparently this is due to the local television stations preventing providers from creator.

The best option (only reliable option?)  I’ve found is is IceTv (which I use), which is a “paid for” service.  Apparently even they have been experiencing ongoing legal battles to keep their service running.  (I used to be under the impression they were the only “sanctioned” provider”)

The great news is that IceTv has just won a landmark legal battle to publish the guide, which means others will undoubtedly follow.

Read all about it here:

Nine loses electronic program guide case – Home Theatre – AtHome – Technology

Posted in Media Center Software | Leave a Comment »

Simple Inter-Process Communication In VB.Net

Posted by anoriginalidea on August 9, 2007

 

image

There are plenty of articles around for inter process communication, using remoting, custom windows messages and named pipes.  In my .net career I think I’ve used all of them.  In this article I’ll outline a technique I’ll be using that I think is quite simple.

In .net Framework 2.0, Microsoft introduced the new System.Runtime.Remoting.Channels.Ipc   remoting channel , which provides one of the easiest (prior to using WCF) techniques.

In this example we have a single server process which is communicated to via client processes. 

image

SharedInterfaces

Firstly, as with all remoting it is necessary to share a type that defines the api you desire between client and server processes.  One of the easiest things to do is to create an interface.

For the sake of this example, I created an assembly called “Shared Interfaces” containing an interface called “ICommunicationService”:

Public Interface ICommunicationService
    Sub SaySomething(ByVal text As String)
End Interface 

Server

image

For the Server in this example, I created a console application (it can be any sort of process).

The Server project contains two classes:

  • An implementation of ICommunicationService called “CommunicationService”
  • A Main that registers to CommunicationService class for acess

The CommunicationService class implements the interface and inherits from MarshalByRefObject :

Public Class CommunicationService
    Inherits MarshalByRefObject
    Implements SharedInterfaces.ICommunicationService

    Public Sub SaySomething(ByVal text As String) Implements SharedInterfaces.ICommunicationService.SaySomething
        Console.WriteLine("The client said : " & text)
    End Sub
End Class

The main registers the type:

Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Ipc
Module Main
    Sub Main()
        Dim ipcCh As IpcChannel
        ipcCh = New IpcChannel("IPChannelName")

        ChannelServices.RegisterChannel(ipcCh, False)
        RemotingConfiguration.RegisterWellKnownServiceType( _
          GetType(CommunicationService), "SreeniRemoteObj", _
                           WellKnownObjectMode.Singleton)

        Console.WriteLine("Press ENTER to quit")
        Console.ReadLine()
    End Sub
End Module

Client

image

The client project is written as a Winform with a textbox and a button.  The button click contains this code:

Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Ipc
Public Class Form1

    Private Sub cmdSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSend.Click
        Dim ipcCh As New IpcChannel("myClient")
        ChannelServices.RegisterChannel(ipcCh, False)

        Dim obj As SharedInterfaces.ICommunicationService = _
          DirectCast(Activator.GetObject(GetType(SharedInterfaces.ICommunicationService), _
          "ipc://IPChannelName/SreeniRemoteObj"), SharedInterfaces.ICommunicationService)
        obj.SaySomething(txtText.Text)

        ChannelServices.UnregisterChannel(ipcCh)
    End Sub

End Class

The code basically gets a reference to the remote object and invokes the “SaySomething” message, passing through a value.

As you can see, it doesn’t take much code to communicate between processes.

Improvements

Further improvements to the code will involve ensuring security (making sure that only desirable client processes are calling).

Links

Posted in .net Framework, Software Development, VB.Net | 13 Comments »