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 6213755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:45:16+00:00 2026-05-24T06:45:16+00:00

Right, I’m trying to write a wee script in PHP that will send an

  • 0

Right,

I’m trying to write a wee script in PHP that will send an in game chat package to Minecraft.

//Deliberately low timeout
$mc = fsockopen("localhost", 25565, $errno, $err, 3);

Now, if that connects successfully, then I send 2 “packets”.

A single byte with the integer 3 in it to tell Minecraft that it should handle the incoming network traffic as a Packet3Chat “packet”:

fwrite( $mc, strrev( pack( "C", 3 )  ) );

This appears to work A-OK**.

The second “packet” that is required is the length of the string as a signed short.

$my_string = "Hello World!";
//119 character limit on Minecraft chat messages
$processed_string = substr($my_string, 0, 119);
fwrite($mc, strrev( pack( "s", strlen( $processed_string ) ) ) );

And that also appears to work A-OK**.

And now all that’s left to do is send the actual string, as chars.

I have tried splitting the string using str_split and sending each character on it’s own using both:

//Signed char
fwrite($mc, strrev( pack( "c", $character ) ) );

and

//Unsigned char
fwrite($mc, strrev( pack( "C", $character ) ) );

And I’ve also tried just sending the whole string by those methods without splitting it up, however I haven’t been able to successfully print out the characters received by readChar() (System.out.println just prints an empty line), and I get an fwrite error 10053 at some point during the sending of the characters – i.e. an EOFException is thrown by readChar().

I’m running the modified Minecraft Server on Windows 7 and I’m running PHP 5.x using XAMPP on the same machine.

Any ideas why the connection would be “closed by software”? And why it would close only during the sending of the characters/string and not during the sending of the byte/short?


** Yes I have used System.out.println to verify the data received by Minecraft.

  • 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-24T06:45:17+00:00Added an answer on May 24, 2026 at 6:45 am

    10053 is the winsock error code for WSAECONNABORTED.
    An “understandable” explaination of that error condition can be found at http://www.chilkatsoft.com/p/p_299.asp

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

Sidebar

Related Questions

Right now I am trying to use selenium ide to write code that makes
Right now I have an SSIS package that runs every morning and gives me
Right now I have a script that creates symlinks to anything newer than 2
right now, I'm going to make a scoreboard for my game. the program will
Right now, I keep all of my projects on my laptop. I'm thinking that
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I
this is what i have right now Drawing an RSS feed into the php,
Right now I have this PHP: $columns = array(*/Data*/); echo json_encode($columns); And this is
Right now, all I see is Visual SVN. Are there other alternatives that would
Right, this is probably going to be pretty simple. I have a form that

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.