Reputation: 374
An application running on the iPad is sending out a broadcast message once every 10 seconds on Port 6122. The goal is to read this message in my Laptop. I'm running the below C# program in my Laptop. For some reason, I don't see any message received in the console window. I tried searching for answers online and also in stack overflow before I post here.
using System.Net.Sockets;
using System.Net;
using System.Text;
int PORT = 6122;
UdpClient listener = new UdpClient(PORT);
IPEndPoint groupEP = new IPEndPoint(IPAddress.Any, PORT);
try
{
while (true)
{
Console.WriteLine("Waiting for broadcast");
byte[] bytes = listener.Receive(ref groupEP);
Console.WriteLine($"Received broadcast from {groupEP} :");
Console.WriteLine($" {Encoding.ASCII.GetString(bytes, 0, bytes.Length)}");
}
}
catch (SocketException e)
{
Console.WriteLine(e);
}
finally
{
listener.Close();
}
Output:
As a first step, I looked up the network traffic in the Wireshark tool. I can see the broadcast message sent by the iPad application as shown below.
Source IP (192.168.1.224) is the address of iPad. Destination IP is the broadcast address (192.168.1.255).
For some reason, my Laptop (IP: 192.168.1.73) is not seeing this packet.
Could someone help understand the issue?
Upvotes: 0
Views: 26