Saurav Prakash
Saurav Prakash

Reputation: 1957

Bittorrent: Getting info_hash in erlang while communicating to udp tracker

I am trying to write a bittorrent client in erlang (release 20).

How do I get the info_hash rightly for communication with udp trackers and peer? I am using below piece of code right now, but its not working as I am not getting response from tracker.

InfoHash = crypto:hash(sha, bencoding:encode(maps:get(<<"info">>, 
DecodedContents))),

Do I need to urlencode it?

Upvotes: 2

Views: 58

Answers (1)

Saurav Prakash
Saurav Prakash

Reputation: 1957

I figured out my mistake after 2 days. I had set socket mode to passive and hence I was not getting any message in the receive block. Setting back to active solved the issue.

Upvotes: 2

Related Questions