add TCP and UDP server samples - #243
Conversation
psychon
left a comment
There was a problem hiding this comment.
Thanks for the examples and sorry for the many comments
| local Gio = lgi.Gio | ||
|
|
||
| local app = Gio.Application{application_id = 'org.test.tcptest', | ||
| flags = Gio.ApplicationFlags.NON_UNIQUE} |
There was a problem hiding this comment.
Why is this a Gio.Application? I have to admit, I do not really know what this is doing, but I would just remove the app.
(Especially with the NON_UNIQUE argument... what does Gio.Application do?)
There was a problem hiding this comment.
Honestly everything should be using Gio.Application, manually dealing with the mainloop isn't helpful.
There was a problem hiding this comment.
Well, what does GApplication do that GLib.MainLoop.new():run() does not do? I really have no idea.
There was a problem hiding this comment.
Most examples use Gio.Application. Probably because syntax is the same as for Gtk.Application.
There was a problem hiding this comment.
In the context of a demo, nothing. In real world applications, single instance support, daemonization, argument parsing, gresource loading, global menus, exporting the freedesktop application dbus interface, its just the API applications should use.
|
Copied assertion from samples/giostream.lua, so it should be double checked. Applied other suggestions. |
|
Tried to test error handling by inserting packet delays and errors via |
|
I don't know why, but the TCP echo server truncates(?) long messages. I used copy&paste to generate lots of "o"s, but the server answered with less "o"s. I tried to get some kind of error, but I also failed. I guess just guessing that it works should be okay then. @TingPing You already checked an earlier version of this. Any more comments or should I just merge this? |
|
Seems good. |
This may be a netcat issue. I used this sample text. When I copy/pasted it into |
|
Thanks! |
Add TCP and UDP server samples.
See #235 for details.