Re: [gnet] Gnet-2.0.7 and win32



sorry, this was condition (condition & G_IO_OUT) and not (condition &
G_IO_IN)

>
> Hi!
>
>> I'm trying to use libgnet-2.0.7 (and GTK+-2.4) for a GUI program.
>> Without going into too much detail, the GUI basically opens a TCP
>> connection to a server and starts reading and writing ascii-text
>> lines to/from it.
>>
>> This works good when the GUI client runs on Linux, but on win32
>> I run into problems..
>>
>>
>> While testing I just use netcat for the server like this:
>>
>>  nc -l -p 1234
>>
>> First I looked into the echoclient example programs and they all
>> works good in Linux, but when compiling them on win32 (with MinGW)
>> I'm having various problems.
>>
>> Browsing the gnet list I see that there seems to be problems with
>> iochannels and glib on win32. The echoclient that is closest to working
>> is echoclient-async.c.
>>
>> On Linux all strings typed in the echoclient-async window directly shows
>> up
>> in the netcat window and vice versa. But on Win32 (Windows XP service
>> pack
>> 1)
>> only lines that are typed in the echoclient-async window are directly
>> sent.
>> Lines typed in the netcat window seems to buffer up somewhere. When I
>> break the
>> connection by typing Ctrl-C in the netcat window then all lines that
>> was previously typed in the netcat window show up in the
>> echoclient-async
>> window. I tried running the netcat command on both Linux and Windows and
>> the result is the same.
>>
>> I modified the code to use only one io watch to try to isolate the
>> problem.
>> In the async_client_connfunc callback I just have:
>>
>>  iochannel = gnet_tcp_socket_get_io_channel(socket);
>>  g_io_add_watch(iochannel, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
>>                 async_client_iofunc, NULL);
>>
>> But async_client_iofunc dont get called until the connection is hanged
>> up
>> by typing Ctrl-C in the netcat "server" window.
>>
>> Then, just for test, I tried to "manually" read and write lines by
>> inserting
>> this directly after the g_io_add_watch line:
>>
>>  gnet_io_channel_readline_strdup(iochannel, &str, &n);
>>  if (str != NULL) {
>>     g_print("read line: %s\n", str);
>>     g_free(str);
>>  }
>>
>>  gnet_io_channel_writen(iochannel, "Hello, netcat!\n", 15, &n);
>>
>>
>> And this works on both Linux and Windows. After the first line is sent
>> from netcat
>> then the client responds with "Hello, netcat!". But then no more lines
>> are
>> received
>> from netcat until the connection is killed...
>>
>
> I think the problem with async echo example from gnet is on the server
> side, as it never gets (condition & G_IO_IN) condition fulfilled. the same
> with glib-2.4.7 and glib-2.6.3.
> I was using gnet-2 on windows in a GTK application and I had no problems
> with it. you can get this code here
> http://sourceforge.net/project/showfiles.php?group_id=62830&package_id=110666
>
> regards
> hs
>
> _______________________________________________
> gnet mailing list
> gnet lists gnetlibrary org
> http://lists.gnetlibrary.org/mailman/listinfo/gnet
>




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