Re: Service with separate Tray interface

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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@xxxxxxxxxxxxxx
I 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.





.



Relevant Pages

  • Re: Dual Port RAM
    ... port A and another number from port B. ... calculated value determined from the data bus size and memory size. ... Avoiding the vendor specific stuff is ... parts for irrational reasons rather than enhance standards like LPM so ...
    (comp.arch.fpga)
  • Re: Open Office
    ... In article, Peter Naulls ... until someone does a credible RISC OS version of Pango/Cairo/Fontconfig, ... It's also the major problem for a Firefox 3.x port, ... enormous, for reasons which defy good explanation, except for its ...
    (comp.sys.acorn.apps)
  • Re: Changing Default SQL ports on SQL 2000 Server
    ... TCP/IP were two different connectivity mechanisms and that if Named Pipes are ... the connections will fail if the default port is changed as ... Named Pipes in SQL 2000 cannot dynamically determine destination port numbers. ... Just change the port via the SQL Server Network Utility. ...
    (microsoft.public.sqlserver.security)
  • Re: Good Reasons to port asp.NET VB.NET app to C#
    ... There is no technical reason that I can see that would require you to port from C# to VB.NET, unless you require some functionality that isnt available from VB.NET. ... reasons to port to C# besides personal preference. ... So I get that the answer is " it's more of a personal preference thing", ... Either keep the app in VB.NET or port the app on your own time ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Yet another thread on the legality of port scanning
    ... > There are legitimate reasons for running a port scan on a ... > computer in a limited fashion, such as service discovery. ... > expect that CNN might have an anonymous FTP site for content. ...
    (Security-Basics)