lgi-devs / lgi

Dynamic Lua binding to GObject libraries using GObject-Introspection
MIT License
440 stars 70 forks source link

add TCP and UDP server samples #243

Closed matsievskiysv closed 4 years ago

matsievskiysv commented 4 years ago

Add TCP and UDP server samples. See #235 for details.

matsievskiysv commented 4 years ago

Copied assertion from samples/giostream.lua, so it should be double checked. Applied other suggestions.

matsievskiysv commented 4 years ago

Tried to test error handling by inserting packet delays and errors via tc, but it didn't work. I think, these errors were caught on kernel level. How do I get Gio to fail?

psychon commented 4 years ago

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?

TingPing commented 4 years ago

Seems good.

matsievskiysv commented 4 years ago

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.

This may be a netcat issue. I used this sample text. When I copy/pasted it into ncat, it got truncated on the phrase From whispers in the wind he could foretell the next day’s weather. Bec, but when I piped xclip contents to the ncat, server received the whole text.

psychon commented 4 years ago

Thanks!