I'm in a Math class about coding theory and we have to do a project for our term mark.
My project is a client with an echo server, which shows what errors were introduced in the trip from the client to the server, and then back. And test different error correcting schemes for efficiency and how well they are suited to this task.
The coding isn't really a problem, I was able to make something that would detect errors, ask for retransmission if unable to fix them and such.
The problem I have is that so far, for me to开发者_高级运维 introduce any type of bit error, I must do it artificially -- since other layers of data transfer have their own error correction protocols.
My question: Is there a way to get around this?
I have no idea how I would go about this or even where to begin.
Also, I know there are protocols I can't tinker with so theres always going to be error correction going on in the background at those levels. But what I'd like is to be able to pretend that one of these layers wasn't checking things itself and then my application would be given the chance to play that role.
If this can't be done, what are some good methods of simulating errors introduced during transmission. I was unable to find statistical information about the distribution of errors in even a simple example of a channel. Given those I could continue with the current approach of having the server introduce errors in the message.
I would start here with JPCap. This should allow you to forge any kind of network packet you want.
You could at least avoid one level of protection by using a UDP scheme instead of a TCP one.
I'd probably just implement one or more subclasses of InputStream and/or OutputStream and code them up to mutate my data stream in various ways. This would make it easy to instantiate lots of different test cases. Then just factor your java code so that the error correcting parts of your code only see a plain InputStream/OuputStream and don't know how the data is being manipulated.
For instance, write one that every Nth byte, changes a single bit at random. And so on. Then open a socket, and wrap that InputStream in your subclass. (A similar technique will work for UDP, just without the stream!)
You can do fancy statistical things to control the error rate if you have the urge and/or the requirement, but I'd probably just focus on pseudo-random tweaking in various ways and at various rates, then run a bunch of different test cases and try to do some fancy analysis on the resulting data instead, if your project requires that.
Mutating the packets at different TCP/UDP layers using some sort of fancy tools is probably possible, but kind of wanders away from the Math you're really supposed to be concentrating on in a Math class! :-)
精彩评论