Problem with TCPListener in PowerPoint Add-In on Windows Vista

M

Mike McClaran

I have the need to listen on a port when a slideshow is running. Opening the
port with TCPListener when the slideshow begins is no problem. However, when
navigating to the next slide, the port gets closed for some reason. This
issue only occurs on Vista. Works fine on XP. Using Office 2007



I have created a very simple add-in that demonstrates the issue. You can
use tcpview from sysinternals to see the port opening and unexpectedly
closing. IP address is hard-coded so you will need to change that if you
want to run the code.



public partial class ThisAddIn
{
private TcpListener listener;
private Application pptMain;


private void ThisAddIn_Startup(object sender, EventArgs e)
{
pptMain = Application;
pptMain.SlideShowBegin += Application_SlideShowBegin;
pptMain.SlideShowNextSlide += pptMain_SlideShowNextSlide;
}


private void pptMain_SlideShowNextSlide(SlideShowWindow Wn)
{
MessageBox.Show("TcpView no longer shows open port");
}

private void Application_SlideShowBegin(SlideShowWindow Wn)
{
try
{
MessageBox.Show("SlideShowBegin");

listener = new TcpListener(IPAddress.Parse("10.2.0.68"),
14557); //Change IP Address
listener.Start();

MessageBox.Show("TcpView should show port 14557 open by
powerpoint");
}
catch (Exception)
{
throw;
}
}

private void ThisAddIn_Shutdown(object sender, EventArgs e)
{
}

#region VSTO generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
Startup += ThisAddIn_Startup;
Shutdown += ThisAddIn_Shutdown;
}

#endregion
}



Any help would be greatly appreciated.



--Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top