Package org.jmule.core.edonkey.packet

Examples of org.jmule.core.edonkey.packet.Packet


      ByteBuffer data = packet.getAsByteBuffer();
      data.position(1 + 4 + 1);
      raw_data.put(data);
      raw_data.position(0);
      raw_data = JMuleZLib.compressData(raw_data);
      packet = new Packet(raw_data.capacity(), E2DKConstants.PROTO_EMULE_COMPRESSED_TCP);
      packet.setCommand(op_code);
      raw_data.position(0);
      packet.insertData(raw_data);
    }
    if(jm_socket_channel.write(packet.getAsByteBuffer()) == -1 )
View Full Code Here


            } catch (InterruptedException e) {
            }
          }
          continue;
        }
        Packet packet = send_queue.poll();
        try {
          sendPacket(packet);
        } catch (Exception e) {
          if (!jm_socket_channel.isConnected()) break;
        }
View Full Code Here

        ByteBuffer data = packet.getAsByteBuffer();
        data.position(1 + 4 + 1);
        raw_data.put(data);
        raw_data.position(0);
        raw_data = JMuleZLib.compressData(raw_data);
        packet = new Packet(raw_data.capacity(), E2DKConstants.PROTO_EMULE_COMPRESSED_TCP);
        packet.setCommand(op_code);
        raw_data.position(0);
        packet.insertData(raw_data);
      }
//      System.out.println("Send packet to peer : " + getIPAddress() + " : " + getPort() +" Header : " + Convert.byteToHex(packet.getProtocol()) + " opcode : " + Convert.byteToHex(packet.getCommand()));
View Full Code Here

            } catch (InterruptedException e) {
            }
          }
          continue;
        }
        Packet packet = send_queue.poll();
        try {
          sendPacket(packet);
        } catch (Exception e) {
          if (!jm_socket_channel.isConnected()) break;
        }
View Full Code Here

    peer_connections.put(ip + KEY_SEPARATOR + port, connection);
    connection.connect();
  }

  public void callBackRequest(ClientID clientID) {
    Packet packet = PacketFactory.getCallBackRequestPacket(clientID);
    try {
      server_connection.send(packet);
    } catch (Throwable cause) {
      cause.printStackTrace();
    }
View Full Code Here

      e.printStackTrace();
    }
  }

  public void doSearchOnServer(SearchQuery searchQuery) {
    Packet search_packet = PacketFactory.getSearchPacket(searchQuery);
    try {
      server_connection.send(search_packet);
    } catch (Throwable cause) {
      cause.printStackTrace();
    }
View Full Code Here

  }

  public void offerFilesToServer(ClientID userID,
      List<SharedFile> filesToShare) {
    try {
      Packet packet = PacketFactory.getOfferFilesPacket(userID,
          filesToShare);
      server_connection.send(packet);
    } catch (Throwable cause) {
      cause.printStackTrace();
    }
View Full Code Here

      if (connected_server != null) {
        server_ip = connected_server.getAddressAsByte();
        server_port = connected_server.getPort();
        client_id = connected_server.getClientID();
      }
      Packet packet = PacketFactory.getPeerHelloPacket(_config_manager
          .getUserHash(), client_id, _config_manager.getTCP(),
          server_ip, server_port, _config_manager.getNickName(),
          E2DKConstants.DefaultJMuleFeatures);
      connection.send(packet);
View Full Code Here

      if (connected_server != null) {
        server_ip = connected_server.getAddressAsByte();
        server_port = connected_server.getPort();
        client_id = connected_server.getClientID();
      }
      Packet packet = PacketFactory.getPeerHelloAnswerPacket(
          _config_manager.getUserHash(), client_id, _config_manager
              .getTCP(), _config_manager.getNickName(),
          server_ip, server_port, E2DKConstants.DefaultJMuleFeatures);
      connection.send(packet);
     
      Packet emule_hello_packet = PacketFactory.getEMulePeerHelloPacket();
      connection.send(emule_hello_packet);
    } catch (Throwable cause) {
      cause.printStackTrace();
    }
View Full Code Here

 
  public void receivedEMuleHelloFromPeer(String ip, int port,
      byte clientVersion, byte protocolVersion, TagList tagList) {
    try {
      JMPeerConnection connection = getPeerConnection(ip, port);
      Packet response = PacketFactory.getEMulePeerHelloAnswerPacket();
      connection.send(response);
    } catch (Throwable e) {
      e.printStackTrace();
      return;
    }
View Full Code Here

TOP

Related Classes of org.jmule.core.edonkey.packet.Packet

Copyright © 2018 www.massapicom. 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.