[Vala] Disconnect socket connection



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

Attachment: tcpClient.vala
Description: Text Data



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