/// <summary> /// Will close the connection with the Given Login /// </summary> /// <param name="login">Login to get support diffrent connecitons</param> public void closeConnection(LoginData login) { int searchedElement; for (int i = 0; i < Logins.Count; i++) { if (login == Logins.ElementAt(i)) { searchedElement = i; } } }
/// <summary> /// Is called if client connects to server /// </summary> /// <param name="asyncResult">The result of the Conection</param> protected static void ConnectCallback(IAsyncResult asyncResult) { try { // Retrieve the socket from the state object. Socket client = (Socket)asyncResult.AsyncState; // Complete the connection. client.EndConnect(asyncResult); Trace.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString()); // Signal that the connection has been made. ConnectDone.Set(); Send(client, "<?xml version='1.0'?>\n<stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client' to='" + Logins.ElementAt(Sockets.IndexOf(client)).getDomain() + "' xml:lang='de' xmlns:xml='http://www.w3.org/XML/1998/namespace'>"); Receive(client); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }