Recent

Author Topic: lnet udp port changes  (Read 4060 times)

hdw

  • Newbie
  • Posts: 1
lnet udp port changes
« on: August 19, 2018, 12:44:50 am »
Hello all,
I'm programming a client software which sends and receives data to/ from an host application via udp using the visual lnet udp control. The host listens on port 49000 and responses on port 49001.
I open UDP with the host ip address='192.168.2.112' and port=49000, prepare a buffer (array of byte) and send the message:
 myUDP.Send(buffer[0],413);
The client source port (60397 see below) is obviously set randomly with the open command.
With Wireshark I see correctly:

6   5.051667   192.168.2.100   192.168.2.112   UDP   455   60397 → 49000 Len=413

Right after that the host sends the response

15   22.118306   192.168.2.112   192.168.2.100   UDP   60   49001 → 60397 Len=13

I handle the receive message in a OnReceive event.
That works fine so far when I send my message once.
But when I send the same message (same buffer) again, then the (host) destination port has changed (from 49000 to  49001):

298   70.875832   192.168.2.100   192.168.2.112   UDP   455   60397 → 49001 Len=413

which is not recognized by the host.
When I close and reopen the udp connection, then the destination port is again 49000 but another (client) source port is assigned but the host needs messages with the same client source port and host port 49000.

Any help is appreciated.

Edit 08/19:
No answer yet, I made some tests...
The client destination port changes from 49000 to 49001 whenever I get the message in my code (e.g. asocket.GetMessage(msg); in the Onreceive event).
I also tried synapse (with TUDPblock) and the same happens here. Sending a message (sock.SendBufferTo(@buffer[0],413) ) and after receiving the response (sock.RecvBuffer(bPtr, 13) ) and sending again the message the destination port also changes to 49001.
It must be something with UDP in general, perhaps because the host ist responding on port 49001.
I have a workaround with synapse: before sending the message I (re)connect (sock.Connect('192.168.2.112', '49000'))
« Last Edit: August 19, 2018, 02:14:47 pm by hdw »

 

TinyPortal © 2005-2018