Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8170005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:02:02+00:00 2026-06-06T21:02:02+00:00

Alright, so I’m trying to connect to UDP trackers using c#, but I never

  • 0

Alright, so I’m trying to connect to UDP trackers using c#, but I never get a response. I also don’t get any errors. Here’s my code.

namespace UDPTester
{
    class MainClass
    {
        public static bool messageReceived = false;
        public static Random Random = new Random();
        public static void LOG(string format, params object[] args)
        {
            Console.WriteLine (format,args);    
        }
        public static void Main (string[] args)
        {
            LOG ("Creating Packet...");
            byte[] packet;
            using(var stream = new MemoryStream())
            {
                var bc = new MiscUtil.Conversion.BigEndianBitConverter();
                using(var br = new MiscUtil.IO.EndianBinaryWriter(bc,stream))
                {
                    LOG ("Magic Num: {0}",(Int64)0x41727101980);
                    br.Write (0x41727101980);
                    br.Write((Int32)0);
                    br.Write ((Int32)Random.Next());
                    packet = stream.ToArray();
                    LOG ("Packet Size: {0}",packet.Length);
                }
            }
            LOG ("Connecting to tracker...");
            var client = new System.Net.Sockets.UdpClient("tracker.openbittorrent.com",80);
            UdpState s = new UdpState();
            s.e = client.Client.RemoteEndPoint;
            s.u = client;
            StartReceiving(s);

            LOG ("Sending Packet...");
            client.Send(packet,packet.Length);
            while(!messageReceived)
            {
                    Thread.Sleep(1000);
            }
            LOG ("Ended");

        }
        public static void StartReceiving(UdpState state)
        {
            state.u.BeginReceive(ReceiveCallback,state);
        }

        public static void ReceiveCallback(IAsyncResult ar)
        {
            UdpClient u = (UdpClient)((UdpState)(ar.AsyncState)).u;
            IPEndPoint e = (IPEndPoint)((UdpState)(ar.AsyncState)).e;

            Byte[] receiveBytes = u.EndReceive(ar, ref e);
            string receiveString = Encoding.ASCII.GetString(receiveBytes);

            LOG("Received: {0}", receiveString);
            messageReceived = true;
            StartReceiving((UdpState)ar.AsyncState);
        }

    }
    public class UdpState
    {
        public UdpClient u;
        public EndPoint e;
    }
}

I was using a normal BinaryWriter, but that didn’t work, and I read somewhere that it wants it’s data in BigEndian.

This doesn’t work for any of the UDP trackers I’ve found, any ideas why I’m not getting a response? Did they maybe change the protocol and not tell anyone? HTTP trackers all work fine.

Trackers I’ve tried

udp://tracker.publicbt.com:80

udp://tracker.ccc.de:80

udp://tracker.istole.it:80

Also, I’m not interested in using MonoTorrent(and when I was using it, the UDP didn’t work anyways).

Protocol Sources

http://xbtt.sourceforge.net/udp_tracker_protocol.html

http://www.rasterbar.com/products/libtorrent/udp_tracker_protocol.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:02:03+00:00Added an answer on June 6, 2026 at 9:02 pm

    UDP is a connectionless protocol, so you won’t see any errors if packets are lost or dropped at the destination.

    Try following diagnostic steps:

    1. Use packet sniffer (Wireshark is a good one) to check that UDP packets are leaving the machine.
    2. Install some working BitTorrent client, check if it can communicate with the tracker and if yes, use packet sniffer to see how the packets sent by the working client differ from the packets your code generates.

    If working client also can not communicate with the tracker, but the UDP traffic is leaving your machine, the UDP packets are likely dropped by a firewall. You can try ‘traceroute’ tool to diagnose where your packets are dropped (this is not always 100% reliable, because sometimes firewalls drop UDP packets generated by traceroute and do not drop normal UDP traffic).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright so using Python with windows I am trying to run a batch command
Alright, I'm trying to use the basic document.getElementsByTagName function, but each time I do,
Alright I am trying to set up an OAuth Provider in PHP, but I
Alright I don't see why this isnt working. It seems pretty simple. Here is
Alright, this is driving me nuts because my regex is working on Rubular, but
Alright so I have no idea how to even begin doing this But basically
Alright, here I am again trying to write code from scratch and I can't
Alright, right now I am trying to create a basic four in a row
Alright I know my error and what it means. But, could someone show me
Alright, I'm injecting some code into another process using the CreateRemoteThread/LoadLibrary trick. I end

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.