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

  • SEARCH
  • Home
  • 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 7066269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:03:46+00:00 2026-05-28T05:03:46+00:00

I am designing a Minecraft Classic server written in Python, but I don’t know

  • 0

I am designing a Minecraft Classic server written in Python, but I don’t know how to send the packets properly. I know how to set up a socket, but the part I don’t know is how to send them in the format needed by the protocol. I understand the protocol, just not how to implement it in Python. I don’t really have code to post, just the heartbeat, and that’s not relevant to my question. I have looked through the source of several servers, but I don’t understand them.

  • 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-05-28T05:03:47+00:00Added an answer on May 28, 2026 at 5:03 am

    As Dan D. mentioned you can use struct.pack to format your data as requested by the protocol. The documentation at http://docs.python.org/library/struct.html has a few examples.

    Then you need to take a look at the packet structure at http://www.minecraftwiki.net/wiki/Classic_Server_Protocol#Packet_Protocol which describes in detail what your packets need to look like. According to the packet description you would need a struct.pack format string looking something like “Bbh” for the first 4 bytes.

    struct.pack("Bbh", 0, 1, 7)
    

    For a player identification packet with id 1 and protocol version 7. You will have to complete this with the rest of the packet 64 byte string + 1024 byte binary part, both with padding.

    EDIT: Just remembered Python might not be native big endian so you might want to throw that into the format string as well.

    struct.pack("!Bbh", 0, 1, 7)
    

    You can find examples of packet formats and how to handle them by looking into the source of the myne2 server

    https://bitbucket.org/andrewgodwin/myne2/src/236deac8cd2f/myne/core/constants.py

    https://bitbucket.org/andrewgodwin/myne2/src/236deac8cd2f/myne/core/packeter.py

    The python module of the week page for struct also has some very useful information.

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

Sidebar

Related Questions

Designing AIR application which has to have server side push or notification, don't know
Designing forms has always been fun, but getting them to send email on the
When designing a lookup table (enum) in SqlServer 2005, if you know the number
When designing a client/server architecture, is there any advantage to multiplexing multiple connections from
I have been designing with jquery and using the jquery UI widgets .. but
Designing a new system from scratch. I'll be using the STL to store lists
When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to
When designing a database to use MVCC (Multi-Version Concurrency Control), you create tables with
While designing a table my colleague here says that I should avoid identity column
When designing user table what would be the must have fields from the security/user

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.