How to create an inventory message and send it? I am trying to create an inventory message of specific hashes that I select. Assuming I have all the hashes stored in a vector, how do I create the message 'manually'? (i.e stuff like getting total length, generating checksum and adding in all the inventory vector elements to the message and then sending it to all my peers.) 

Any help is appreciated, if you can point me at any Bitcoin core (v0.14 or v0.15) source code that handles this kind of stuff that is also welcome.
You can use Peter Todd's python-bitcoinlib, which contains builders for all the network messages.

Simple example, given a list of hashes:

from bitcoin.net import *
from bitcoin.messages import *

m = msg_inv()
for h in hashes:
    assert len(h) == 32
    inv = CInv()
    inv.type = 1  # TX
    inv.hash = h
    m.inv.append(inv)

inv_msg = m.serialize()


This assumes that the list of hashes you have are little endian unhexlified strings.