Void type?



Hi,

i'am trying with gjs or seed to read data from a socket. But i'am stuck with the
read method from Gio.DataInputSteam. The read method need as first argument a
pointer (http://www.roojs.org/seed/gir-1.1-gtk-2.0/Gio.DataInputStream.html) but
how can i do this with javascript? 

Here is my code : 

const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
var client = new Gio.SocketClient()
var adress = new Gio.NetworkAddress({'hostname': '127.0.0.1', 'port':26});
var conn = client.connect(adress, null);
var response = new Gio.DataInputStream({base_stream: conn.get_input_stream()});
var b = String('');
var readByte = response.read(b, 256, null)
print(b);

This code fail in gjs telling me that b is null. It execute fine in seed, but
print(b) doesn't output anything.

Thanks.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]