Async TCP

Posted by Greebapple on Wed 20 Apr 2016 08:09 AM — 7 posts, 22,285 views.

#0
hi everyone.

My problem in short words: I have an amazing mud mapper (written in python, available at https://github.com/michael-donat/tf-mapper , this is not my doing!) that uses TCP connection to pass the information between mapper and mud. Now, one way communication is pretty straight forward: when i send data to mapper it reacts immidiately. But it also sends notifications to MUD (for instance about non standard commands to exit a location). How can i react on received message in real time? in other words, how can i wait async for the message?

Im asking in a LUA thread although i'll be happy with solution with almost any language, i tackled this problem once before with python, no success. i even tried creating a rest api for my mapper but performance was not good enough.

and i remember reading somewhere that Nick is fan of callbacks and asyncs vs threads so i dont expect to be able to just spawn new thread.

if im not clear please let me know, also forgive my ignorance, i come from java world ;)

thanks
#1
Also tried python asyncore (https://docs.python.org/2/library/asyncore.html) which causes mush to crash immidiately
Australia Forum Administrator #2
Quote:

... uses TCP connection to pass the information between mapper and mud ...


Do you mean the MUD server or the MUD client?
#3
Hi Nick,

Sorry i wasnt clear. What i meant is it uses tcp to pass data between mapper application and mud client.
Australia Forum Administrator #4
Can the Python mapper act as a server? You might be able to connect to it from a dummy world and then await input from the mapper (similar to awaiting input from a MUD). Then do a world-to-world message.
#5
thanks for suggestion, will give it a try and report results
#6
WOW.

I REALLY spent some time looking into this. could never think it was THAT simple. you the man Nick!

thanks

edit: obviously when i wrote the response i was overwhelmed with emotions !!! to elaborate a bit: all i had to do is type localhost in IP field and specify a port and it worked. now few simple triggers + passing data to 'main' world and im good ;)