Hallo,
I am developing an application where there is a source which sends UDP datagrams at a constant Interval (2 datagrams per second). I am receiving these datagrams in the following code:
the flag clsMisc.Listenf orUDP is true as long as the application runs. This is set to false when an user Logs off.
This is working properly when a user logs in and logs off three times consecutively. But when an user logs in fourth time. I found out by debugging that the program hangs
after
byt = UDPInput.Receiv e(EP)
this line. I have also tried with asynchronous connection (Beginreceive and end receive) and also with
UDPInput.Client .SetSocketOptio n(SocketOptionL evel.Socket, SocketOptionNam e.ReceiveBuffer , 0) to flush the buffer before I read the byt but in vain. It is always the fourh time that the problem arises.
I am trying this to solve for the last 3 days without success. I shall be grateful if somebody helps me.
Thanks.
Roy
I am developing an application where there is a source which sends UDP datagrams at a constant Interval (2 datagrams per second). I am receiving these datagrams in the following code:
Code:
EP = New IPEndPoint(IPAddress.Any, clsUDP.nListenOnPort)
(' clsUDP.nListenOnPort=6466)
UDPInput = New UdpClient(EP)
While clsMisc.ListenforUDP
Try
byt = UDPInput.Receive(EP)
..................
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End While
UDPInput.Close()
UDPInput = Nothing
EP = Nothing
This is working properly when a user logs in and logs off three times consecutively. But when an user logs in fourth time. I found out by debugging that the program hangs
after
byt = UDPInput.Receiv e(EP)
this line. I have also tried with asynchronous connection (Beginreceive and end receive) and also with
UDPInput.Client .SetSocketOptio n(SocketOptionL evel.Socket, SocketOptionNam e.ReceiveBuffer , 0) to flush the buffer before I read the byt but in vain. It is always the fourh time that the problem arises.
I am trying this to solve for the last 3 days without success. I shall be grateful if somebody helps me.
Thanks.
Roy
Comment