Display a MOTD with NO server running?

Discussion in 'Bukkit Help' started by MaliciousMan, Aug 10, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    MaliciousMan

    I've seen it done before, so that's why I didn't post in the request section of this forum. But is there anyway for me to have it so when someone has my server's IP in the Multiplayer server list, that I can have a different source show a motd like, "Server will be back up in a month!" or something.

    This would greatly help, my requirements are no cost, like use a free webhoster like: http://www.000webhost.com/ ? I have little to no idea how one would attempt this, or if it's even possible now that MC has been updated to 1.6.2. But if there's even a slightest chance, please let me know.
     
  2. Offline

    Jade

  3. Offline

    MaliciousMan

    What I meant was, the server itself won't even be on. I was going to change the destination of my server's IP to direct to a free host and have the free host be running a PHP script or something to give a motd back.

    I can do everything up to the point where it points to a PHP script. What would I tell it to do?
     
  4. Offline

    Jade

    I'm fairly certain a PHP script cannot return a MOTD to a client.
     
  5. Offline

    MaliciousMan

    Jade I thought it was a simple variable sent to the client when requested. Is it not?

    EDIT: *string ... fuck, my bad. variable is just so general
     
  6. Offline

    Bobcat00

    Here's the protocol: http://wiki.vg/Server_List_Ping
    You would have to emulate that. The PHP script would have to be listening on port 25565 (not port 80), and return the proper response.

    You might find it helpful to use Wireshark to capture examples of the packet data. When I did that, I saw that every byte sent by the client was a separate TCP transaction. (Ugh) Seems to me you'd have to accumulate the data based on the sending IP address and port, so you can handle concurrent transactions.
     
  7. Offline

    MaliciousMan


    Couldn't it just respond with the same response each time it was requested?
     
  8. Offline

    Bobcat00

    To clarify, there was one 3-way handshake to establish the connection. But each packet contained only 1 data byte, instead of sending all the data as one packet.

    Unfortunately, I don't have the data handy right now to show you an example.

    Yes it could. But you need to know what data to expect from the clients.

    Again, Wireshark would be helpful to see exactly what data the server currently sends, then you know what to send back. :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  9. Offline

    MaliciousMan

    A 3-way handshake? Could you summarize what was contained in each?
     
  10. Offline

    Bobcat00

    Just the normal way TCP establishes a connection.

    Turns out I do have some sample data:

    Code:
    fe01
    fa00
    0b00
    4d00 M
    4300 C
    7c00 |
    5000 P
    6900 i
    6e00 n
    6700 g
    4800 H
    6f00 o
    7300 s
    7400 t
    1d49   I
    000b
    0031   1
    0039   9
    0032   2
    002e   .
    0031   1
    0036   6
    0038   8
    002e   .
    0030   0
    002e   .
    0032   2
    0000
    63dd c
    
    ff00
    2100 !
    a700 
    3100 1
    0000
    3700 7
    3300 3
    0000
    3100 1
    2e00 .
    3600 6
    2e00 .
    3100 1
    0000
    a700    *
    6100 a
    4100 A
    6e00 n
    6400 d
    2000
    7700 w
    6500 e
    2700 '
    7200 r
    6500 e
    2000
    6200 b
    6100 a
    6300 c
    6b00 k
    0000
    3000 0
    0000
    3200 2
    30   0
     
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  11. Offline

    MaliciousMan

    This is for the current MC version? [1.6.2]
     
  12. Offline

    Bobcat00

    That appears to be from 1.6.1. 1.6.2 would probably be the same except for the "1.6.1" string.
     
  13. Offline

    MaliciousMan

    I have an additional question, doesn't the packet need a user to confirm the download?

    I'm trying to figure this out, when I use PHP to send a packet of predefined data to port 25565 I have to also know what IP to send it to. Problem is, everyone's IP is different so it would have to detect it when it's requested. Right?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  14. Offline

    Bobcat00

    You're going to listen on port 25565. When you get some data, you would send your reply to the sending IP address and port (which is not 25565). With PHP, this seems to come from socket_getpeername.

    I've never done this, but it looks like you need to use socket_create, socket_bind, socket_listen, socket_accept, and socket_getpeername. See the info at http://www.php.net/manual/en/ref.sockets.php

    Oh, and you would simply run PHP from a command line, not as part of a web server.

    Look around on the 'Net, someone may have already written this, although most Minecraft status code will be to get a server's status, not emulate it.

    Any particular reason you're not willing to use Java and MCSignOnDoor?
     
  15. Offline

    MaliciousMan

    Since my server isn't going to be on. I want something to display for my players in the server list though.

    Are you saying it's not possible to run it on a web server? Or that it's easier not to.

    Believe me, I have. I don't think I know what to search though. I mean someone has to have done this before... right? xD

    MCSignOnDoor does what I want the script to do xD Man I wish he made a web hosted version.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  16. Offline

    Bobcat00

    I think you're a little confused. A PHP script as part of a web server/page only gets invoked when someone accesses that web page. This isn't happening with Minecraft! There's no web access involved.

    You need something that's running all the time and listening on port 25565. That can be a PHP script invoked by a command line on the web hosting box. Or it can be MCSignOnDoor invoked by running Java on the web hosting box.

    Or are you saying you don't have shell access with your web hosting account? I don't know if it's possible to invoke a PHP script via a web page and have the script keep running indefinitely. Probably not.
     
  17. Offline

    MaliciousMan

    How would I go about running java and having MCSignOnDoor running with a free web host?
     
  18. Offline

    Bobcat00

    You would have to ask them. Chances are, you can't. Do they provide access via Telnet or SSH?
     
  19. Offline

    MaliciousMan

    The registered PHP streams are: compress.zlib, compress.bzip2, tftp, ftp, telnet, dict, ldap, http, https, ftps, php, file, data, & zip.
    There's nothing about SSH, sorry.
     
  20. Offline

    Jade

    The list you gave includes telnet.
     
  21. Offline

    MaliciousMan

    Jade What's your point?
     
  22. Offline

    Jade

    MaliciousMan He asked about SSH or TelNet. I'm fairly certain he meant one or the other.
     
  23. Offline

    MaliciousMan

    Jade I made Telnet bold, italicized, and underlined so he could see it. But I see what you're saying, I only said they didn't support SSH, I didn't say "yes" to telnet.
     
  24. Offline

    Bobcat00

    It has nothing to do with what PHP supports. It's if your host provides you with shell access via Telnet or SSH.

    The more I think about this, the more I'm convinced you won't find a free web host that will allow you to do this. You would be much better off finding a Minecraft host, setting Minecraft to whitelist mode, and using an appropriate MOTD.
     
  25. Offline

    MaliciousMan

    Alright man, thanks for the help and time. :)
     
Thread Status:
Not open for further replies.

Share This Page