Re: [Vala] Disconnect socket connection
- From: "Gilzad Hamuni" <gilli4 gmx net>
- To: vala-list gnome org
- Subject: Re: [Vala] Disconnect socket connection
- Date: Tue, 29 Jul 2014 15:58:49 +0200
Thanks a bunch, Andrew!
The Socket class' shutdown() helped. I'm not sure if I can use the ThreadedSocketService for client side
connections though. But it's a good idea for another project, where my application is the server. So thanks
for both. :)
Best
gilzad
Gesendet: Dienstag, 29. Juli 2014 um 00:29 Uhr
Von: "Andrew Benton" <andrew benton675 gmail com>
An: "Gilzad Hamuni" <gilli4 gmx net>
Betreff: Re: [Vala] Disconnect socket connection
Try using the Socket class' shutdown() method. http://www.valadoc.org/gio-2.0/GLib.Socket.shutdown.html
I don't have time to try it out atm. I also know that if you use the ThreadedSocketService, you can get a
connection to shutdown whenever then run() delegate returns. That could make your job easier.
Thanks,
Andrew
On 7/28/2014 11:12 AM, Gilzad Hamuni wrote:
Hi all,
I've written a little tcp client class and it works well, except that I can't disconnect an existing
connection.
private SocketClient client;
private SocketConnection conn;
public void Connect()
{
client = new SocketClient();
conn = client.connect(socketAddress, null);
}
public void Disconnect()
{
stdout.printf("TcpClient.Disconnect(): Disconnecting...\n");//I do arrive here.
conn.socket.close();
conn.close();
conn.dispose();
client.dispose();
conn = null;
client = null;
//no exception/assertion will occour. All the commands will be executed but won't affect the connection.
}
None of what I'm trying here does really disconnect my connection. I traced it in Wireshark and nothing
happens (no RST). Even nulling the instance of my own Tcp client doesn't help. Unless I close my whole
application, only then the connection will be terminated. But I can't force the user to close the application
just to disconnect and connect again.
I'll be glad about any help. Thanks.
gilzad
_______________________________________________
vala-list mailing listvala-list gnome
org[vala-list@gnome.org]https://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]