Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.XMPPConnection.sendPacket()


        try{
            connection.login(user, password);
            System.out.println("Logged in as " + connection.getUser());
            Presence presence = new Presence(Presence.Type.available);
            connection.sendPacket(presence);

        } catch (XMPPException ex){
            Logger.getLogger(JabberWorkItemHandler.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("Failed to log in as " + connection.getUser());
            System.exit(1);
View Full Code Here


        // Create a packet collector to listen for a response.
        PacketCollector collector = con
                .createPacketCollector(new PacketIDFilter(request.getPacketID()));

        con.sendPacket(request);

        // Wait up to 5 seconds for a result.
        IQ result = (IQ) collector.nextResult(SmackConfiguration
                .getPacketReplyTimeout());
        if( dialog.cancelled ) return;
View Full Code Here

        // Create a packet collector to listen for a response.
        PacketCollector collector = con
                .createPacketCollector(new PacketIDFilter(request.getPacketID()));

        con.sendPacket(request);


        // Wait up to 5 seconds for a result.
        IQ result = (IQ) collector.nextResult(SmackConfiguration
                .getPacketReplyTimeout());
View Full Code Here

        // Create a packet collector to listen for a response.
        PacketCollector collector = con
                .createPacketCollector(new PacketIDFilter(request.getPacketID()));

        con.sendPacket(request);

        // Wait up to 5 seconds for a result.
        IQ result = (IQ) collector.nextResult(SmackConfiguration
                .getPacketReplyTimeout());
        if( dialog.cancelled ) return;
View Full Code Here

      long start = System.currentTimeMillis();
      for (Iterator iterator = packets.iterator(); iterator.hasNext();) {
        IQ iqPacket = (IQ) iterator.next();
        iqPacket.setFrom(connection.getUser());
        PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(iqPacket.getPacketID()));
        connection.sendPacket(iqPacket);
        IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        collector.cancel();
       
        if (response == null) {
          throw new XMPPException("No response from server on status set.");
View Full Code Here

  private boolean sendPacket(IQ packet) {
    XMPPConnection con = adminUser.getConnection();
    try {
      packet.setFrom(con.getUser());
      PacketCollector collector = con.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
      con.sendPacket(packet);
      IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
      collector.cancel();
     
      if (response == null) {
        // OLAT-5383: error happens frequently, lowering to WARN
View Full Code Here

  private boolean sendPacket(IQ packet) {
    XMPPConnection con = adminUser.getConnection();
    try {
      packet.setFrom(con.getUser());
      PacketCollector collector = con.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
      con.sendPacket(packet);
      IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
      collector.cancel();
     
      if (response == null) {
        log.error("Error while trying to create/delete group at IM server. Response was null! packet type: "+packet.getClass());
View Full Code Here

      SessionCount response;
      try {
        IQ packet = new SessionCount();
        packet.setFrom(con.getUser());
        PacketCollector collector = con.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
        con.sendPacket(packet);
        response = (SessionCount) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        collector.cancel();
        if (response == null) {
          log.warn("Error while trying to count sessions at IM server. Response was null!");
          return sessionCount;
View Full Code Here

  private IQ sendPacket(IQ packet) {
    XMPPConnection con = adminUser.getConnection();
    try {
      packet.setFrom(con.getUser());
      PacketCollector collector = con.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
      con.sendPacket(packet);
      IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
      collector.cancel();
     
      if (response == null) {
        log.error("Error while trying to get all sessions IM server. Response was null!");
View Full Code Here

      try {
        IQ packet = new PluginVersion();
        packet.setFrom(con.getUser());
        PacketCollector collector = con.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
        //TODO:gs is sending packets over one connection thread save?
        con.sendPacket(packet);
        response = (PluginVersion) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        collector.cancel();
        if (response == null) {
          log.error("Error while trying to get version at IM server. Response was null!");
          return version;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.