F
Frank Rizzo
I am trying to send a UDP packet out over the internet to a device.
This device is NOT on a local network or LAN or WAN. Just a random IP
address on the internet somewhere.
For whatever reason, the UDP message does not arrive there the first
time I send it (after starting the app). It arrives fine for any
attempt afterwards, but never the first time.
What could the problem? I am kind of new to UDP, so I am at a loss. Do
I perhaps have to establish a route to the IP address or something like
(I am grasping, I know).
Meanwhile, if I send a message to a device on a local network, the
messages get there every time. Here is the code I use to send a message:
Socket sockUDP = New Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp)
Dim sendBytes As Byte() = Encoding.ASCII.GetBytes(Data)
Dim IpEndPoint As New IPEndPoint(IPAddress.Parse(Host), Port)
sockUDP.Connect(IpEndPoint)
sockUDP.SendTo(sendBytes, 0, sendBytes.Length, SocketFlags.None, IpEndPoint)
Thanks.
This device is NOT on a local network or LAN or WAN. Just a random IP
address on the internet somewhere.
For whatever reason, the UDP message does not arrive there the first
time I send it (after starting the app). It arrives fine for any
attempt afterwards, but never the first time.
What could the problem? I am kind of new to UDP, so I am at a loss. Do
I perhaps have to establish a route to the IP address or something like
(I am grasping, I know).
Meanwhile, if I send a message to a device on a local network, the
messages get there every time. Here is the code I use to send a message:
Socket sockUDP = New Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp)
Dim sendBytes As Byte() = Encoding.ASCII.GetBytes(Data)
Dim IpEndPoint As New IPEndPoint(IPAddress.Parse(Host), Port)
sockUDP.Connect(IpEndPoint)
sockUDP.SendTo(sendBytes, 0, sendBytes.Length, SocketFlags.None, IpEndPoint)
Thanks.