[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Async TCP

Async TCP

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Greebapple   (5 posts)  [Biography] bio
Date Wed 20 Apr 2016 08:09 AM (UTC)
Message
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
[Go to top] top

Posted by Greebapple   (5 posts)  [Biography] bio
Date Reply #1 on Wed 20 Apr 2016 04:43 PM (UTC)
Message
Also tried python asyncore (https://docs.python.org/2/library/asyncore.html) which causes mush to crash immidiately
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 20 Apr 2016 07:48 PM (UTC)
Message
Quote:

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


Do you mean the MUD server or the MUD client?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Greebapple   (5 posts)  [Biography] bio
Date Reply #3 on Wed 20 Apr 2016 11:07 PM (UTC)
Message
Hi Nick,

Sorry i wasnt clear. What i meant is it uses tcp to pass data between mapper application and mud client.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 21 Apr 2016 04:15 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Greebapple   (5 posts)  [Biography] bio
Date Reply #5 on Thu 21 Apr 2016 08:10 AM (UTC)
Message
thanks for suggestion, will give it a try and report results
[Go to top] top

Posted by Greebapple   (5 posts)  [Biography] bio
Date Reply #6 on Thu 21 Apr 2016 10:11 AM (UTC)

Amended on Thu 21 Apr 2016 12:07 PM (UTC) by Greebapple

Message
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 ;)
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


13,887 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]