?
Solved

Problem porting app to Terminal Servics because of IP Port usage.

Posted on 2012-08-14
3
Medium Priority
?
531 Views
Last Modified: 2012-08-20
We have a client server application that works very well in a standard windows installation.  We would now like to port the app so it can work in a MultiPoint 2011 Server.

We had one problem with config files being locked by one user, but have gotten around this using User Settings. But we have one problem left.  The different instances of the application open a TCP UDP port for listening to broadcast messages to indicate a status change on another instance.

The problem arises on terminal services / multipoint server when two users run the app, the second user gets an error as the IP / Port is already open with the first instance.

I have instructed Multipoint to assisgn a seperate IP address for each session, but this does not seem to help.

Below is the code I use for listening, I am hopng someone can suggest where I am going wrong.

Thanks

private static bool _isClosing;
private static bool _isNetUp;
private static UdpClient _udpClient;
private static IPEndPoint _remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);

private static void ReceiveMsgs()
        {
            while (!_isClosing)
            {
                if (!_isNetUp)
                {
                    _udpClient = new UdpClient(2000);

                    _isNetUp = true;
                }

                while (!_isClosing)
                {
                    var buffer = _udpClient.Receive(ref _remoteEndPoint);

                    SystemDateMessage msg;

                    using (var ms = new MemoryStream(buffer))
                    {
                        var bf = new BinaryFormatter();

                        try
                        {
                            msg = (SystemDateMessage)bf.Deserialize(ms);
                        }
                        catch (SerializationException e)
                        {
                            ExceptionHandling.Debug("Failed to deserialise system date message. Reason: " + e.Message);
                            throw;
                        }
                        finally
                        {
                            ms.Close();
                        }
                    }

                    ProcessMessage(msg);
                }
                Thread.Sleep(1000);
            }
        }

Open in new window

0
Comment
Question by:townsma
  • 2
3 Comments
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 38294282
What you might need to do is have a master app run on the TS that listens on the port and the client apps "subscribe" to this master app communicating through another mechanism.
0
 
LVL 6

Accepted Solution

by:
townsma earned 0 total points
ID: 38299112
After performing a bit more research I found an article on the web where someone else was using a UDPClient on a terminal server.  There are some additional setting s I can use to allow multiple apps use the same IP/port combination. I believe is the answer I was looking for.
0
 
LVL 6

Author Closing Comment

by:townsma
ID: 38311021
After performing a bit more research I found an article on the web where someone else was using a UDPClient on a terminal server.  There are some additional setting s I can use to allow multiple apps use the same IP/port combination. I believe is the answer I was looking for.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question