Vala:使用 GIO/Socket 示例进行网络连接不起作用
我正在尝试从 http://live.gnome.org/Vala/GIONetworkingSample 复制“服务器示例” 。
但是当我尝试编译时,出现以下错误:
./src/server/Anais.vala:51.4-51.34: error: 2 missing arguments for `ssize_t GLib.OutputStream.write (void* buffer, size_t count, GLib.Cancellable? cancellable = null)'
output.write( header.str.data );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./src/server/Anais.vala:52.4-52.31: error: 2 missing arguments for `ssize_t GLib.OutputStream.write (void* buffer, size_t count, GLib.Cancellable? cancellable = null)'
output.write( content.data );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 2 error(s), 0 warning(s)
make: *** [build-server] Erreur 1
我试图理解错误消息的含义。所以我查看了文档: http://www.valadoc.org/references /gio-2.0/0.11.5/GLib.OutputStream.write.html
但由于我不习惯使用 glib 和/或任何客户端/服务器库,我不明白我应该做什么 做。
有人可以告诉我如何将 OutputStream
与 Vala 一起使用吗?
注意:仅供参考,我使用的是 valac 0.10.0
I'm trying to copy the "server example" from http://live.gnome.org/Vala/GIONetworkingSample.
But when I try to compile, I have the following error :
./src/server/Anais.vala:51.4-51.34: error: 2 missing arguments for `ssize_t GLib.OutputStream.write (void* buffer, size_t count, GLib.Cancellable? cancellable = null)'
output.write( header.str.data );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./src/server/Anais.vala:52.4-52.31: error: 2 missing arguments for `ssize_t GLib.OutputStream.write (void* buffer, size_t count, GLib.Cancellable? cancellable = null)'
output.write( content.data );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 2 error(s), 0 warning(s)
make: *** [build-server] Erreur 1
I tryed to understand, what the error message means. So I looked at the documentation :
http://www.valadoc.org/references/gio-2.0/0.11.5/GLib.OutputStream.write.html
But as I'm not used to use glib and/or any library for client/server, I don't understand what I should do.
Could someone say to me how to use the OutputStream
with Vala ?
NB : For information, I'm using valac 0.10.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该示例被列为要求 Vala >= 0.11.0 —— API 随着每个奇数次要版本而更改(因此 0.11.x 是导致稳定 0.12.x 的开发系列),并且 API 似乎自 0.10.x 以来已发生变化
如果您使用的是 Linux,您使用的是哪个发行版?如果您安装了足够新的版本,大多数应该有 Vala 0.12.x。
That example is listed as requiring Vala >= 0.11.0 -- the API is changed with every odd-numbered minor release (so 0.11.x is the development series leading to the stable 0.12.x), and it seems that the API has changed since 0.10.x
If you're on Linux, which distribution are you on? Most should have Vala 0.12.x if you have a recent enough release installed.