PacketSender icon indicating copy to clipboard operation
PacketSender copied to clipboard

When sending UDP packet the source port is different than expected sometimes.

Open wmanning opened this issue 5 years ago • 7 comments

What OS?

Windows 10 x64

Description of issue

  1. I go into File > Settings: 1.(a) check Enable UDP Servers 1(b) put say "20601" for UDP Server Ports.

When I send a packet to my server, the server says the source (aka "From Port" using packetsender's terminology") port is different than 20601. I'm wondering if somehow the port is taken and packetsender just picks an available port at random. I would expect a warning in that case but did not get one.

wmanning avatar Jun 16 '20 21:06 wmanning

Thanks for submitting this ticket.

Packet Sender will pop a warning if a port is taken. You can see this happening by launching a second instance of Packet Sender. See screenshot:

image

If you proceed with a failed bind, Packet Sender, as you suspect, will then use random UDP ports to send. I hoped this effect was clear by showing the UDP server button as disabled. See screenshot:

image

  • Are you seeing random source ports despite the server button showing disabled?
  • Are you in IPv6 Mode (bottom right button) but sending to an IPv4 address? Packet Sender will dynamic bind if bound to IPv6 but an IPv4 address is chosen.

I agree passively choosing a random port is not great, but I wouldn't want to disable UDP completely if port failed to bind (there are uses to 1-way UDP tests). I could put an additional bottom-left notification whenever a random source port is chosen. That would keep functionality and not make the UI too noisy.

dannagle avatar Jun 18 '20 02:06 dannagle

I don't get that port bind popup. It also does not say "UDP Server Disabled". For instance I just set the port now to 20700. I don't get a warning and it displays "UDP: 20700 in the status at the bottom of the main window but the port it picked was 10934. I test by sending a command to my server.

Here are the settings I used: image

wmanning avatar Jun 18 '20 16:06 wmanning

This is the main window. You can see the source port is 20700. But that is not what the server sees. To be clear, I'm not sure if this issue is due to the port being taken or not (I was just guessing that was the reason). Maybe there is another reason.

packetsendermain

wmanning avatar Jun 18 '20 16:06 wmanning

It also seems to change the source port if there is a few minutes elapsed between sending the next UDP. At first it was using port 11384. I went on to do something else for a few minutes and came back to it and sent another UDP. It is now using 11929. That doesn't happen when I manually sending messages back to back (within a few seconds of each other).

The status at the bottom still says "UDP: 20700".

wmanning avatar Jun 18 '20 17:06 wmanning

I'm going to try to recreate this. Are you sending to a device on your LAN (192.168.1.x)?

dannagle avatar Jun 19 '20 23:06 dannagle

No, to a server hosted on AWS.

wmanning avatar Jun 20 '20 03:06 wmanning