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

How the contract works? #21

Closed
CraigglesO opened this issue Jan 14, 2017 · 2 comments
Closed

How the contract works? #21

CraigglesO opened this issue Jan 14, 2017 · 2 comments

Comments

@CraigglesO
Copy link

Hey friend. I have a P2P wire protocol question.

I have been building my own implementation. I have been simulating responses from other P2P programs to test and I can’t get passed the handshake. I get a handshake:

bufferSize!: 68
Protocol type: BitTorrent protocol
infoHash: aff8bda8adebdab34e1af9ac648bd93c13ed6344
peerId: 2d4c54313030302d764874743153546a4d583043

Then I try sending a handshake back or a interested or any other code...
Do you have any advice?

Thanks,
Connor.

P.S. - you have something very strange in my mind...
You set the protocol buffer like this: '\u0013BitTorrent protocol'
But that's strange in my mind because it should be \u0019. The string is 19 bits! So how does your implementation even work?! You must be getting the majority of success from ws rather then tcp.

@CraigglesO
Copy link
Author

Nevermind, you where right! It's \u0013. I don't know why you say you are sending 13 bytes when you are really sending 19. But I am getting responses now and on to the next phase... Seems most torrent software is happiest if you start your next message after handshake with a have message... Otherwise some pretty much just say to screw off.

@feross
Copy link
Member

feross commented Jan 16, 2017

0x0013 in hex is 19 in decimal.

Without more information, it's not really possible to guess what's wrong with your program. The best advice I have for you is to run through the test suite for this package and set DEBUG=* so you get the full debug output including every message that is sent. If you make sure your program is sending the same messages in response to a remote peer, then it should work.

@feross feross closed this as completed Jan 16, 2017
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