Sending and receiving an image over sockets/Internet with C# - c#

Problem:
In TCP/IP one sender and one Receiver.
4 The computer is connected to the Internet via Two Router.
Computer A and Computer B connected to Internet Via Router 1
Computer C and Computer D Connected to Internet via Router 2
How can Computer A Send Continuous Images to Computer C.
How Can Computer C Receive Via Port or anything else?
My Problem is if I am sending images via internet I have must be required IP Address of Receiver mean Computer C. But in this Case, all computer Connected Via Router. I can’t find Computer IP Address because it is connected to Router. The router has one public IP Address. Ex. Router 2 has two Computer connected then how can I identify “Computer C” IP Address and Computer D IP Address
How can we communicate this two pc which is connected via two different routers?
Mean one pc can send data and pc receive data continuously. Both and connected via the Internet.
I have read many posts on this website but I can’t find how to find IP Address of computer when the computer is connected to Router and Communicate via the internet.

Related

How to pickup requested IPs from a LAN port

Assuming I had a WiFi router connected to my computer through a LAN cable (this one).
And assuming I had my phone connected to the WiFi router and would try to visit a website on my phone-browser.
What is the easiest way to pickup the requested website address with my computer?

c# get IP of a PC which turned network discovery off

I use the Ping class to test every possible address in the network. But PCs with the option: Turrn off network discovery do not respond to ping (windows can not discover them too). Is there any way to get the IP and name of these PCs?

Connecting Tcp Client from one device to Tcp Server in another device

The Tcp client/server code I'm working with is here: client and server.
As the title goes, I'm running the server code on my computer and I want to connect to it from another device using the client code. My question is, to what ip address does my client code have to connect? I know there are many related posts, but I'm only getting information on what's wrong rather than the solution.
This is a common problem when developing client/server applications. In a typical home network, there are multiple local IP addresses and a single external IP address. All devices communicating with your network from the outside must use the external IP address. However, when writing client/server applications, if you simply input the external IP address as the address to connect to, you'll quickly discover this won't work.
You need to use Port Forwarding. The client and server will be communicating over a specific port, and Port Forwarding is how your router knows which local IP address to send data to when the client is connecting to the external IP address. You want to login to your router settings, navigate to the section regarding Port Forwarding, and specify that communication over the port you're using in your server should be redirected to the local IP address that your server is running on. Exactly how to change these settings on your router depends on which router you're using.
Run the ipconfig command in a Windows Command Prompt on the machine running your server. Obtain the local IPv4 address from the results. This is the address to use when Port Forwarding the port used by your client/server applications. Adjust your router settings accordingly, and then your client should be able to use your external IP address just fine.
To find your external IP address, any website such as http://www.whatsmyip.org/ should work fine.
If you want to avoid all of these problems for now and simply test your application on your home network, then use the local IPv4 address found when running the ipconfig command on the machine your server is running on. Note that this will only work if both the client and server are running on the same network.

Application connects to a different Wi-Fi network but receives same IP address

I’m working on a C# application. I need to know when the application connects to a different Wi-Fi network. The tricky part here is that the application is assigned the same IP address on both Wi-Fi networks:
The application is currently connected to Wi-Fi #1 with IP address 11.22.33.44.
On the PC where the application runs, I disconnect the PC from Wi-Fi #1.
The PC quickly connects to Wi-Fi #2 and is assigned the same IP address (in this example 11.22.33.44).
The application receives the NetworkChange.NetworkAddressChanged event.
The application loops in the network interfaces returned by NetworkInterface.GetAllNetworkInterfaces() in order to detect an IP address change (by checking if the IP address, assigned to a particular NetworkInterface.Id, has changed).
The problem is that the network interface information has not changed (NetworkInterface.OperationalStatus is still UP and the IP address is the same).
The NetworkChange.NetworkAvailabilityChanged event is not received. If the NetworkInterface.OperationalStatus was to DOWN and then back to UP, I could detect a change.
Any idea?
Is it possible to access the list of Wi-Fi network and find out which one the application is connected with?
Thanks!
Provided you are only interested in testing Wi-Fi networks, you could use the SSID to determine which network you are on.
Get SSID of the wireless network I am connected to with C# .Net on Windows Vista

Client cannot connect to server

I'm newbie in WCF, so I really need your help.
I have two programs which uses WCF.
If they are running on one computer and client uses adress net.tcp:\Localhost:8001\MyService to connect to server(which has adress 192.168.1.1 for example) everything is OK.
But when I'm changing adress for client to net.tcp:\192.168.1.1:8001\MyService I'm getting system.timeoutexception because client cannot connect server.
Thanks for help.
You may need to allow external access to the port in the firewall.
As long as you're communication from localhost to localhost, the firewall doesn't come into play, as these requests are handled by the loopback adapter.
But when communicating from localhost to the machines IP address, you're making a network request that's handled by the firewall (even though you're still on the same machine physically).
By the way: For the server side it doesn't matter whether you start the WCF service with endpoint localhost or 192.168.1.1.
EDIT
I wrote that it doesn't matter whether you listen on localhost or 192.168.1.1 - this is only true if you only have one network adapter available.
As soon as there are two or more network cards (for example: Wireless LAN is turned on and you're connected via cable), localhost or 0.0.0.0 will make the service listen on any adapter. Using 192.168.1.1 will make the service listen only for connections on that IP address.
This is important to know especially in cases where the different network adapters become members of different (sub)networks.
For example: One adapter is connected to the 192.168.1 network and the other adapter is connected to the 192.168.2 network. If your service listens on localhost or 0.0.0.0 it will be reachable from both networks. If it only listens on 192.168.1.1, it will not be available for the 192.168.2 network.
Please check "192.168.1.1" is included in your "hosts" file. And give it a try.
The hosts file can be found in "C:\Windows\System32\drivers\etc"

Categories