-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add TCP and UDP server samples #243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly everything should be using Gio.Application
, manually dealing with the mainloop isn't helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most examples use Gio.Application
. Probably because syntax is the same as for Gtk.Application
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.