2
« on: May 29, 2019, 09:12:51 pm »
Hi, I'm new to the forums here. I'm currently trying to utilize Qb64 to make my own little mud. It won't be anything grand, but hopefully decent when all is said and done. I can get the client I made to connect to the server I made, however, I can't seem to get the test string I send from Server to Client to say "Welcome to Euphoria" on the screen of the client.
Here is the server source code:
'Euphoria - server code for my first mud!
'by KrashSmith81@gmail.com, Krash Smith
cls
main:
server = _OPENHOST("TCP/IP:1981")
PRINT "Waiting for connection..."
DO
HOST = _OPENCONNECTION(server)
LOOP UNTIL HOST <> 0
print
PRINT "A player has joined!"
SLEEP 2
'print #host, "Welcome to Euphoria!"
currMsg$ = "Welcome to Euphoria!"
PUT #host, , currMsg$
close #host
And here is the client code:
'Euphoria - client code for my first mud!
'by KrashSmith81@gmail.com, Krash Smith
cls
main:
client2server = _OPENCLIENT("TCP/IP:1981:127.0.0.1")
PRINT "Attempting connection to Euphoria Server..."
if client2Server = 0 then
print "Connection Failed!"
end
end if
print
PRINT "Connection Successful!"
SLEEP 2
'input #client2Server, serverMsg$
GET #client2server, ,serverMsg$
print serverMsg$
close client2Server
I've tried adding an amperstand to the end of the handle, and switching which handle I use, and I know I need some command to make sure the data is sent before I read it. I've tried using INPUT #(handle name), and PRINT #(handle name), also when that didn't work I tried using PUT and GET. The server says, "A player has joined", like it should, and the client says "Connection Successful" like it should. However, the message from the client to the server ("Welcome to Euphoria"), is never displayed. I know making my own mud will require a lot more than this, but right now I'm just trying to nail down the basic framework. Thanks in advance for any help you can provide, and should this little dream of mine ever come to fruition, anyone who helped me make it happen will be given GOD status on my MUD, lol :)
Thanks again for any and all help,
Krash