3 Commits

Author SHA1 Message Date
b11429d418 Enable input/output buffering and fflush only explicitly
As suggested in old pull request: #39
2024-12-04 16:33:49 +02:00
e9f8b0e76f Remove Valve protocol checks and set select() timeout to 1.5 seconds
Use the same method for handling multipacket responses across all servers.
2024-12-04 16:30:53 +02:00
c607925b2e Implement select() loop to receive all incoming packets:
Send a "multipacket guard" - an empty packet with an invalid 'cmd' field
and a unique packet ID to trigger a reply from the server once the previous
command's reply has been fully sent.

Valve returns an empty payload, while Minecraft includes an error message in the payload.

This workaround ensures that all packets related to the last valid command
are received from the server, avoiding the need to wait for the select() timeout.
2024-12-04 12:58:49 +02:00
5 changed files with 475 additions and 577 deletions

View File

@ -1,18 +1,13 @@
Building and installing
-----------------------
### Prerequisites
#### Requirements & dependencies:
- GCC compatible compiler
- make
- POSIX.1 support
* getopt()
* strcasecmp()
* tcflush()
- POSIX getopt support from **<unistd.h>**
---
### Compiling
#### Compiling
cc -std=gnu99 -Wpedantic -Wall -Wextra -Wno-gnu-zero-variadic-macro-arguments -O2 -o mcrcon mcrcon.c

View File

@ -1,21 +1,17 @@
#### Version history:
###### 0.8.0
- Implement support for multipacket responses
- Add support for Valve style rcon authentication
- Add experimental UTF-8 support for Windows
###### 0.7.3
- Add support to Valve style rcon authentication
- Change maximum packet size to correct value (4096 -> 4106)
- Attempt to add missing newlines in bugged Minecraft servers
* Implemented for responses to the 'help' command and unknown commands
- Print auth failed message to stderr instead of stdout
- Fail immediately if received packet size is out of spec
- Return proper exit code from run_terminal_mode()
- Add error messages to rcon_command() function
###### 0.7.2
- Quit gracefully when Ctrl-D or Ctrl+C is pressed
- Remove "exit" and "quit" as quitting commands
* These are actual rcon commands on some servers
* these are actual rcon commands on some servers
- Suppress compiler warning (strncpy)
- Fix erroneous string length in packet building function
- Fix typo in ANSI escape sequence for LCYAN

View File

@ -15,7 +15,7 @@ RM = rm -v -f
CC ?= gcc
CFLAGS = -std=gnu99 -Wall -Wextra -Wpedantic -Wno-gnu-zero-variadic-macro-arguments -O2
EXTRAFLAGS ?= -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -pie -Wl,-z,relro -Wl,-z,now -fno-common
EXTRAFLAGS ?= -fstack-protector-all
ifeq ($(OS), Windows_NT)
LINKER = -lws2_32

View File

@ -1,7 +1,7 @@
.\" Process this file with
.\" groff -man -Tascii mcrcon.1
.\"
.TH MCRCON 1 "December 2024" "Version 0.8.0"
.TH MCRCON 1 "November 2024" "Version 0.7.3"
.SH NAME
mcrcon \- send rcon commands to a Minecraft server
.SH SYNOPSIS

1025
mcrcon.c

File diff suppressed because it is too large Load Diff