Dropped Packets and vb.net

  • Thread starter Thread starter scorpion53061
  • Start date Start date
S

scorpion53061

I have an application that for the majority of users is without a problem.
However, there are a certain select group whose network (could be their ISP
I think) seems to have a dropped packet problem.

A log file indicates the following:

2004-03-05 14:02:46 2648/TCP from xx.xxx.xx.xx (my ip address):1433 to
xx.xxx.xx.xx (their IP address of router):2648(sometimes the port is 2603
sometimes others) Invalid TCP packet received, dropped packet

The result of this is that they lose their connection to my server of course
and if there happens to be activity going on at that time the application
will throw an exception (which I handle). The usual exception is "General
Network Error; Check your documentation at
System.SqlClient.SqlCommand.ExecuteReader...". I am sure most of you have
seen this exception before.

Anyway, in the application there is what I call a Message Center that does a
loop, checks for updates to the message center that runs in a seperate
thread. Becuase the vast majority of users do not suffer this issue I do not
want to do away with this functionality. I am not even sure it would
help....

However, is there a way I can deal with the dropped packet problem in code
or does anyone have suggestions on this.

I have little hope I will find a solution here but perhaps you guys will
surprise me. No one on my team has a clue how to deal with this and we are
all kind of scratching our heads on how to try and control this.
 
Can you supply a little more information?

For instance, does this problem occur during the transfer of new
message to the user?

Lost packets occur all of the time and even though the occurence of
this problem has decreased as the networks got more reliable it still
happens. However, this should not prevent you from delivering the
information to the user. If it would be so, than not a single FTP
server/client would be able to function together, because they would
need to handle packet loss.

The way a TCP socket handles this problem is by having 2 sequence
numbers.
The first number is for connection pool.
And the second number is for packet.

So, here is the sequence of what should be done:
1) User logs in, a unique connection number is assigned to them and
sent back to the user, so they know what it is.
2) User receives packets, and sends you back an acknowledgement of the
packet numbers that he received.
-----Connection Break happens here -----
3) User reconnects and supplies the old connection number and the last
packet number that you sent to them and they received
4) You resume your send from that packet number


That's the general idea.

You can read more details about this in any book that describes
implementation of Networking Protocols.

Hope this helps.

-Igor
 
Back
Top