Re: Service with separate Tray interface
- From: "Bill McCarthy" <Bill@xxxxxxxxxx>
- Date: Fri, 23 May 2008 05:22:23 +1000
Be aware that the user can be using 3rd party firewalls as well. Some do by default block localhost, 127.0.0.1, that's in fact one of the reasons I used named pipes in .NET.
"Chas" <nospam@xxxxxxxxxx> wrote in message news:OeednefZ4p-NW6jVnZ2dnUVZ_uGdnZ2d@xxxxxxxxxxxxxx
I have written chat programs using Winsock before, so I am familiar with the control. Now I have to look into opening a firewall port. Thank you for the tip for Inno.
Thanks,
Charlie
"expvb" <nobody@xxxxxxx> wrote in message news:%23s7RO5DvIHA.4560@xxxxxxxxxxxxxxxxxxxxxxx"Chas" <nospam@xxxxxxxxxx> wrote in message news:mJidnY4xfpHHKajVnZ2dnUVZ_sHinZ2d@xxxxxxxxxxxxxxI saw this example and it looks clear cut, but... It appears that the server portion is in a constant Do/Loop looking for messages. Won't this take a serious hit on the cpu waiting for a message? Wouldn't something like Winsock which is interrupt driven be better?
It doesn't use CPU time during the wait, but it's not a good design for VB6 because it freezes the server GUI during the wait. However, you can use CreateEvent() and pass the handle to the structure in the second parameter in ConnectNamedPipe(). In this case, ConnectNamedPipe returns immediately, and you can check if a client connected by using a Timer and calling WaitForSingleObject() with a timeout value of 0. In this case, the function checks if the operation is finished and returns immediately without waiting.
Named pipes can be easier than Winsock because they can send and receive entire blocks(You won't receive half a block), while Winsock could give you half a block and you have to implement extra code to make sure that you received the entire message or command. However, on the same computer you are most likely to see the entire message unfragmented in a single DataArrival event(as long as you enable TCP_NODELAY, see MSKB Q237688), over the Internet or from other computers, you could receive the message or command fragmented and you have to wait for the next DataArrival to assemble the message.
Also, TCP/IP ports are blocked by default by Windows Firewall(In XP+SP2 and after), so you need to open the port by changing the configuration at setup time from the installer. If you are using Inno Setup, you can search their newsgroups for solutions to this.
http://www.jrsoftware.org/newsgroups.php
Finally, Named pipes are unlikely to be allowed to be used over the Internet for security reasons, except in VPN. Opening these ports would open the network to attacks, so network administrators are not likely to do it. But in your case, using named pipes on the same computer is not a problem.
.
- References:
- Service with separate Tray interface
- From: Chas
- Re: Service with separate Tray interface
- From: Chas
- Re: Service with separate Tray interface
- From: Bill McCarthy
- Re: Service with separate Tray interface
- From: Bill McCarthy
- Re: Service with separate Tray interface
- From: Chas
- Re: Service with separate Tray interface
- From: expvb
- Re: Service with separate Tray interface
- From: Chas
- Service with separate Tray interface
- Prev by Date: Re: Totally odd
- Next by Date: Re: Lets clear this issue up
- Previous by thread: Re: Service with separate Tray interface
- Next by thread: Re: Service with separate Tray interface
- Index(es):
Relevant Pages
|