Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting corrupted data in one end point #16

Open
amiiigh opened this issue Jul 25, 2019 · 5 comments
Open

getting corrupted data in one end point #16

amiiigh opened this issue Jul 25, 2019 · 5 comments

Comments

@amiiigh
Copy link

amiiigh commented Jul 25, 2019

Heyyy it's me again :D

So I have a new problem.
The thing is I encrypt my data before sending it to my client and the client has to decrypt the data obviously! So I add some data before the real data as a header and I validate the header on the client. So if I couldn't read the header correctly that means there is something wrong with the data.

which is happening when I'm using the library. Should I split the data before sending it? Is there something that I'm missing here?
How should I approach this problem?

How would the library react if packets received unordered?

Thanks <3

@shovon
Copy link
Owner

shovon commented Jul 26, 2019

Thanks for bringing up this issue. I will be looking into it on Saturday.

It's an insanely busy week for me.

Cheers.

@amiiigh
Copy link
Author

amiiigh commented Jul 29, 2019

I think there is a missing 'var' behind 'bools' on line 16 of Packet.js btw

@amiiigh
Copy link
Author

amiiigh commented Jul 30, 2019

Hey
An update on the problem.
I tried sending an html file from my laptop to a server using rudp and the server got the file with no problem ( file size: 200K)
But when I tried the library with a large file ( a pdf file 9M) the received file had different size every time I tried.
So I think it does not work with large files apparently.
I would appreciate if you could take a look at this.
In the meantime, I'm trying to read the code and to see if I can find something.

Thanks brother

@amiiigh
Copy link
Author

amiiigh commented Aug 5, 2019

Thanks for bringing up this issue. I will be looking into it on Saturday.

It's an insanely busy week for me.

Cheers.

Hey,
After banging my head on my wall enough I found the problem.
The problem was when we have enough windows to make the random function to generate the baseSequenceNumber same for two consecutive windows.

if (packet.getSequenceNumber() === this._syncSequenceNumber) { this._packetSender.send(Packet.createAcknowledgementPacket(packet.getSequenceNumber())); return; }

In this case, the server will stay desynced and send the ack for the sync packet. The client after seeing the ack for sync packet would continue sending data. Since the server is desynced, the server will ignore the incoming packets which make the system break!

Fix:
I will submit a pull request soon.
I fixed this if and also changed a couple of small things.
I would appreciate if you take a look at it.

Cheers <3

@amiiigh
Copy link
Author

amiiigh commented Aug 8, 2019

I made the pull request.

btw since I read the whole code I think I can write documentation for this library like what are the classes and what does each one do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants