views:

287

answers:

3

Is it possible to use sockets on win32 and and not have the firewall possibly block the port you are using? Something like with unix wwere you have IF_UNIX instead of IF_INET ( named pipes instead of sockets ). I dont want to use named pipes on win32 since they are just so unreliable.

+1  A: 

I haven't tried this, but I'd suggest that if you bind to the loopback address then you should be clear of the firewall. You'd probably want to do that anyways if you're looking for an alternative to named pipes since it should be faster than actually communicating over the NIC.

Have you looked at other alternatives such as shared memory? Nevertheless, the advantage of switching to sockets is that you could, later on, put the two processes on seperate machines and still communicate without code change (assuming you avoid the mistake of hardcoding the IP address).

John Cavan
A: 

As John Cavan (who I think I once went to school with) says, using the loopback address should avoid the NIC and firewall altogether, and also gives you the ability of changing to a full client-server model (i.e. separate machines, possibly on different platforms) later on with minimal code changes.

I have also used shared memory successfully for same-machine communications. This is generally faster that TCP/IP and named pipes. However, I have found named pipes on Win32 to be reliable and relatively fast.

Graeme Perrow
A: 

There's an address, something like one ninety two one sixty eight dot var dot var that I brought up with Java, using a randomly selected port in the private use range and win let's it run with no complaint.

Nicholas Jordan