0

I'm making a chat program in Visual Basic. It's supposed to be for LAN, and it's called LANChat.

It starts a listener on port 65535 (just for now) and continues to listen on that port. However, if you tried to open two instances of it at once, there'd be a runtime error. I've handled that, and it shows a MessageBox and closes the program if it detects that the port is currently being used. However, in Visual Studio, when attempting to test the program, it runs the program as if it's already being run. I looked in task manager and I see "LANChat.vshost" is running at the time. Any ideas? The only idea I have is to comment out the exception handling code while testing.

lmcintyre
  • 98
  • 7
  • By 'Runs as if its already being run', you mean that the port fails to open, because its apparently still open in some other process, correct? – Kratz Sep 26 '12 at 17:57
  • possible duplicate of [What is the purpose of the Visual Studio Hosting Process?](http://stackoverflow.com/questions/2069940/what-is-the-purpose-of-the-visual-studio-hosting-process) – Hans Passant Sep 26 '12 at 18:46

2 Answers2

0

It would be better to create your progra as a single Instance program. Than you should avoid the vshost probme. I've done it for myself and it works fine. Sorry i cannot provide code, I am at home :(

0

Under your project properties > Debug you can deselect the 'Enable the Visual Studio hosting process'. This will take the hosting process out of the question, if it works then then hosting process was interfering somehow, if not then the problem lies elsewhere.

Kratz
  • 4,280
  • 3
  • 32
  • 55