I agree it's far from trivial. 

Some of the complexity comes from the fact this code used to run on 2
"real" threads, to avoid blocking - so there was business on the main
thread and business on the "network" thread (stuff with names like
t_...). Jive has since then changed to use coroutines ("collaborative
multitasting") by some smart changes in the beast bowels, but the code
did not change.

The idea was to have a function (called the source) that was to be
called to provide the data to be sent, and then to add to the network
thread task list the task of sending data to the given socket by
calling the given function (i.e. t_addWrite(some_function, timeout)).

Now there are a lot of issues in a generic socket code you probably
don't need. Large connect time generally appear on the WAN, not the
LAN. You do not probably need to resolve the IP from a name, etc...

For a quick and dirty route, blocking, use socket directly. This is
LuaSocket (google it for the doc, or it is in the repo
(src/luasocket/doc). In the squeezeplay code, you can see it
"requires("socket")".

HTH

Fred


-- 
Fred
------------------------------------------------------------------------
Fred's Profile: http://forums.slimdevices.com/member.php?userid=2170
View this thread: http://forums.slimdevices.com/showthread.php?t=53357

_______________________________________________
jive mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive

Reply via email to