Realive example:
The second network card is not active. I ping 192.168.13.255 and get
no response (because of firewall, maybe). This machine is running on
Window Domain.
----------------------------------------------------------
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : what.soever.com
IP Address. . . . . . . . . . . . : 10.225.229.206
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.225.229.251
Ethernet adapter Local Area Connection 2:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.13.255
Subnet Mask . . . . . . . . . . . : 255.255.255.240
Default Gateway . . . . . . . . . :
----------------------------------------------------------
Both Client and Server are located on the same machine, and I am
trying to locate each other using either "localhost" or "127.0.0.1"
I use MarshalByRefObject:
1. Client call Server interface and get a reference of value type. Say
funcA(out string, out int, ... etc). It works great.
2. Client call Server interface and get a reference of object. Say
ObjB = funcB(). It works great and ObjB was returned successfully.
3. Client try to access some public member variables in ObjB. Says
ObjB.VarB. It failed.
Below is what I observed:
Client call Server funcB. It is using localhost.
Server return Client with ObjB. It is using localhost.
When Client access ObjB.VarB. It is using 192.168.13.255:8080 (and it
failed!)
As I saw the last entry (in netstat below) right after the call, and
it hangs there.
TCP computer-a:4933 localhost:1555 ESTABLISHED
TCP computer-a:4935 localhost:http ESTABLISHED
TCP computer-a:4946 localhost:1555 ESTABLISHED
TCP computer-a:4947 localhost:8080 TIME_WAIT
TCP computer-a:4952 localhost:8080 TIME_WAIT
TCP computer-a:4954 localhost:http ESTABLISHED
TCP computer-a:4956 localhost:8080 TIME_WAIT
TCP computer-a:4958 192.168.13.255:8080 SYN_SENT
Question now is: How can I ensure that the Client use "localhost" or
"127.0.0.1" instead of 192.168.13.255? Or did I made any mistakes?
Certainly I can try to fix my machine and remove the 2nd network card.
But it is there for some specific reason, and there are thousands of
these machine in the production line, I can't go to change each and
everyone of them when I want to deploy my software.
Thanks In Advance.