anchor.diff:      gen_tcp:send(Socket, Datagram).
   
   %%--------------------------------------------------------------------
  -%% Function: send_handshake
  -%% Description: Send a handshake message
  -%%--------------------------------------------------------------------
  -send_handshake(Socket, PeerId, InfoHash) ->
  -    ok = gen_tcp:send(Socket, build_handshake(PeerId, InfoHash)).
  +%% Function: initiate_handshake
  +%% Description: Handshake with a peer where we have initiated with him.
  +%%  This call is used if we are the initiator of a torrent handshake as
  +%%  we then know the peer_id completely.
  +%%--------------------------------------------------------------------
  +initiate_handshake(Socket, PeerId, InfoHash) ->
  +    HandShake = build_handshake(PeerId, InfoHash),
  +    HandShakeSize = size(HandShake),
  +    PSSize = length(?PROTOCOL_STRING),
  +    % Since we are the initiator, send out this handshake
  +    ok = gen_tcp:send(Socket, HandShake),
  +    % Now, we wait for his handshake to arrive on the socket
  +    % Since we are the initiator, he is requested to fire off everything
  +    % to us.
  +    case gen_tcp:recv(Socket, HandShakeSize, ?DEFAULT_HANDSHAKE_TIMEOUT) of
  +	{ok, Packet} ->
  +	    <<PSL:8,
  +	     ?PROTOCOL_STRING,
  +	     _ReservedBytes:64/binary, IH:160/binary, PI:160/binary>> = Packet,
  +	    if
  +		PSL /= PSSize ->
  +		    {error, packet_size_mismatch};
  +		IH /= InfoHash ->
  +		    {error, infohash_mismatch};
  +		PI /= PeerId ->
  +		    {error, peer_id_mismatch};
  +		true ->
  +		    ok
  +	    end;
  +	{error, closed} ->
  +	    {error, closed};
  +	{error, timeout} ->
  +	    {error, timeout}
  +    end.
   
   %%--------------------------------------------------------------------
   %% Function: recv_handshake
  
positive.code: -module(peer_communication).
  
  %% API
  -export([recv_handshake/3, send_handshake/3]).
  -export([send_message/2, recv_message/1,
  	 construct_bitfield/2, destruct_bitfield/2]).
  
  -define(PROTOCOL_STRING, "BitTorrent protocol").
  -define(RESERVED_BYTES, <<0:64>>).
  
  
negative.code: 				      _ ->
  					  false
  				  end
  			  end, [{B1, 1}, {B2, 2}, {B3, 3}, {B4, 4},
  				{B5, 5}, {B6, 6}, {B7, 7}, {B8, 8}]),
      Res = lists:map(fun({_, N}) ->
  		      N + Add
  	      end, Select),
  