Server
Class MessageSend

public class MessageSend

Title: MessageSend

Description:Handler for messages to send

Copyright: Copyright (c) 2004

Company:Baylor University

Version:
1.0
Author:
CSI 5321
Method Detail

HandShake

public static boolean HandShake(java.net.Socket socket,
                                java.lang.String peerID,
                                java.lang.String info_hash)
This does the handshake function. Returns true if successful.
Parameters:
socket - Socket
peerID - String
info_hash - String
Returns:
boolean
Throws:
IOException -
InterruptedException -

msgBitField

public static boolean msgBitField(java.net.Socket socket)
sends the bit field
Parameters:
socket -
Returns:

msgLenID

public static boolean msgLenID(java.net.Socket socket,
                               int len,
                               byte ID)
Function that will send a message only with the length and ID. Returns true if successful.
Parameters:
socket - Socket
len - int
ID - byte
Returns:
boolean

msgLenIDPiece

public static boolean msgLenIDPiece(java.net.Socket socket,
                                    int len,
                                    byte ID,
                                    byte[] piece)
This sends a id, len and the requested Piece
Parameters:
socket -
len -
ID -
piece -
Returns:

trackerHandShake

public static boolean trackerHandShake(java.net.Socket socket,
                                       java.lang.String peerID,
                                       java.lang.String info_hash)
Parameters:
socket -
peerID -
info_hash -
Returns:
Throws:
IOException -
java.lang.InterruptedException -