UDPClient.receive and network PORT issue?

G

Guest

Hi,

My application sends and receives data in UDP format (Byte arrays). I use a
UDPClient Listener to a specific IP address (User select but starts with
192.168.*.*) and Specific port (2004).

My application will work fine for a couple of hours or an average of 300
send and recieves of UDP datagram packets. Then, it appears that my
application sends data but the 3rd party application doesnt reply.

However after further investigation it appears that the 3rd party
application does send a reply packet but that my application doesnt detect
it. I have used Ethersniffer network packet sniffer to determine this.

What im trying to find out is that with my UDPClient do I have to clear it
or something.... is there a buffer that I need to clear.... What can I do to
be sure that the network side of things are fine. Im open to accept that it
could be a bug in my application but I need to be sure that its not to do
with the UDPClient.

I can continue to send packets but will not get any replies.

Any suggestions?

Thanks in advance.
 
G

Guest

How does your "3rd party application" send replies? Is it over UDP as well.
If it is, you'd need to have a listener on your side on appropriate port to
intercept those replies.

HTH... Alex
 
P

Paul G. Tobey [eMVP]

The first thing that I'd do to try to figure out what's going on is write a
C/C++ version of my program using WinSock. Run that. Does it fail after
the same period of time? If so, you may have run against some type of OS
bug. I think it's more likely that the C program will never have a problem,
though. If that's the case, look at how you are releasing the resources
that you are allocating. Is the buffer that you're filling with the UDP
data being released? Are you allocating the socket every time a packet is
received? That would be a bad design and might leave you, eventually,
without a valid socket to open, for example.

Paul T.
 
G

Guest

Hi,

Here is some of my code:

'Globally held.
Public recDatagram As Byte()

Try
'Blocks until data recieved at port.
recDatagram = UDPClientListener.Receive(PacketReceivedFromIPEP)
Catch odEx As System.ObjectDisposedException
MsgBox("UDPClientListener is disposed: " & odEx.ToString)
'--
'--
End Try

Are you referring to the buffer "recDatagram" because ive not cleared it
anywhere so everytime a new datagram is received it gets copied into it. Im
assuming that whenever a new datagram is received the whatever was in
recDatagram is emptied and the new one copied into it, is that correct? What
should I do? Is the max size of this Byte array 1024 bytes?

The socket is allocated only once upon application startup.

What i was saying is that my listerner works fine for a few hours (average
300 datagrams sent and received) but suddenly it "seems" that it stops
working..... although the network packet sniffer shows a reply packet has
been sent by the 3rd party software.

All advice/assistance GREATLY appreciated.
 
P

Paul G. Tobey [eMVP]

I don't see anything wrong, but you should examine the calls that you are
making, reread the help, etc.

My suggestion was in the previous message: try it in C.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top