Android 10 udp brodcast not receive - udp

Hi i use udp socket in android to find device and change their network parameter, example: change ip address of device.
In previous android my code works well and it is able to receive packet from different subnet example:
my ip is 192.168.43.5 and i send packet to 255.255.255.255 port 8888
device ip is 192.168.1.45 and send responce to 255.255.255.255 8889
why in android 10 i receive udp packet only if the device have the same subnet of my phone (ex if device ip = 192.168.43.45 works else if device ip = 192.168.1.45 not works)?

Related

When receiving on UDP socket listening on ANY/0.0.0.0 address, to which local IP was the packet sent?

On my system I have multiple IP addressed. A UDP socket is listening to them all by binding to 0.0.0.0:5005.
Call recvfrom to wait for data.
In the response a sockaddr is filled with the address of the remote sender.
But how do I get to know which of my local IP the packet was sent to?
Is the a way to know?
Or do I need to explicitly open a socket for each IP address on the system?

How do I get the forwarded ip address

I have a router provided to me by my iSP (Bezeq). In the router, I have configured port forwarding for port 80 to one of the machines on my local network. When the packets are received by the web server, they show the originating IP address as the address of the router. How can I get the IP address that originated the request?
Using tcpdump, I have inspected the packets and see no reference to this address. There has to be some obscure router setting I need to change to make this work.

Receive TCP with 2 IP Addresses - VB.Net

I'm making a chat program and i have a big problem : I have to make my computer listen more IP Adresses .
I mean that my computer will have to receive TCP data addressed to different IP at the same time .
Example :
the Computer 1 send "Hello 1" to the IP 192.168.1.103 and
the Computer 2 send "Hello 2" to the IP 192.168.56.1
My Computer (with IP : 192.168.58.1) have to receive both the messages ( i think that the only way to do that is to change continuosly my computer IP from 192.168.1.103 to 192.168.56.1 and the other way around)
Yes i know , it's a little hard ...
There's a more simple way to make this ?
As #tcarvin mentioned, UDP is more advisable. You can use UDP as the initial protocol for a TCP-IP connection and then operate the rest of the chat over TCP-IP after the connection is established.

ICMP Destination unreachable (Port unreachable) error

I will describe the problem that I encounter below which is the error message that I can see in WireShark:
ICMP Destination unreachable (Port unreachable)
I am connecting an IP Camera like this:
IP Camera --> Router(no internet connected) --> My PC Computer
IP Camera IP Address: 192.168.1.101
PC Ethernet IP Address: 192.168.1.104
I have disabled all firewalls in Windows 10 and have no antivirus software
(Above 2 IP are put as static IP Address Reservations in the TP-Link Router)
Now I use some code that I have (I will try to not post the code as I dont think that is the problem).
When I run the code, I use WireShark to sniff out what the problem is and I get as seen in image below this error message:
ICMP Destination unreachable (Port unreachable)
I have googled on this error message and I have red almost every post I can find but no one really tells how to solve this problem. Only what it means.
The image shows the error. However each time I run the code, the source/destination ports changes everytime so they are not static. It could be for example those ports as I tried the code at least 3 times:
Source ports: 65063,64077,51923 etc (PC computer)
Destination ports: 6987,6991,6995 etc (IP Camera)
What is causing this error and what can I do to solve this error?
(Image from WireShark)

What happens when two clients send UDP packets to a Socket

Lets assume Host X has a UDP Socket running on Port 1337.
Now Host Y and Z both send a UDP Packet to port 1337 of Host X.
Are the packets going to be de-muxed?
UDP is a transfer protocol with no guarantees of delivery and doesn't have much of an implementation.
When both host Y an Z send a UDP packet to port 1337, and assuming both packets arrive, the application listening on port 1337 decides what happens with those packages. The application can choose which packet to demux, to demux both or to demux neither.
Hope this clears things up