TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marco Hajek
NA
1
1.2k
Php Code to C# Help
Jun 18 2014 7:47 PM
Hey Guys...
I need help... I wrote a little Guide for my Minecraft Server. On my Homepage i can read out the Slots and Message of the Day of my running server. But i got no Idea how i could do this in C#.
I hope you can help me...
Here is the php Code:
<?php
function fetch_server_info($ip, $port)
{
$socket = @fsockopen($ip, $port, $errno, $errstr, 1);
if ($socket == false)
{
return false;
}
fwrite($socket, "\xfe");
$data = fread($socket, 256);
if (substr($data, 0, 1) != "\xff")
{
return false;
}
$data = explode('§', mb_convert_encoding(substr($data, 3), 'UTF8', 'UCS-2'));
return array(
'motd' => $data[0],
'players' => intval($data[1]),
'max_players' => intval($data[2])
);
}
?>
Reply
Answers (
0
)
sms
Read QR code with web cam