Page 1 of 1

More socket stuff. Your input is needed.

Posted: Fri Mar 20, 2015 10:35 am
by Administrator
Previously, all socket data was held in an alternate thread and only exposed to the Lua side through MicroMacro's event system. After rewriting a good portion of the code, this is no longer the case. Any data that a socket receives can be requested at any time in your scripts without causing any blocks, like so:

Code: Select all

-- This will display all information held in the socket's receive queue before moving forward
local data = socket:recv();
while( data ) do
  print("More data:", data);
  data = socket:recv();
end
The data will still also be available via the "socketreceived" event. As of right now, even if you use socket:recv() to grab and pop a message off its input queue, that same message will also be passed to macro.event() later as a socketreceived event, and vice-versa; the two do not modify each other. This also means that any data not popped off the queue will still remain in it until popped off, and not be automatically flushed each logic frame. This is where your input comes in.

Should already-read messages (popped off the queue from socket:recv()) still be passed as an event?
Should the socket:recv() queue be flushed every logic cycle? (Note: any unhandled messages would be flushed *after* the events)
Is there any other functionality needed?

Re: More socket stuff. Your input is needed.

Posted: Tue Jul 14, 2015 10:27 am
by beanybabe
Its like your talking in a foreign language.

I get the jist, it seems you working on network data. I wanted to drop a couple coins on that topic. I feel it may be a bad idea. Imagine someone putting data transfer code in a wp and copying your password or document folders on your pc.