In order to gather the information shared between BGP peers, what port number should be used to connect using TCP (I am using 179, and don't see the connection being established)? Will I be able to connect to port 179 of the BGP router that has the port open, and stream some information?
BGP must be configured for a particular neighbor. You cannot arbitrarily connect your router to another BGP router without configuring the other router to form a neighbor with your router.
Will I be able to connect to port 179 of the BGP router that has the port open, and stream some information ?
I'm not sure what you mean by that. BGP neighbors only exchange information in a specific format. BGP has a protocol (a set of rules for how to communicate), and the BGP neighbors follow the protocol.
Thank you @Ron for the information. By gathering the information I mean- is it possible for my router to gather the routing information from the BGP peers ? Alternatively, I am trying to connect to a BGP router and see what all information about the router can be gathered. I am working on applications which would like to understand the various routers exchanging information over BGP protocol. How is this done- "configuring the other router to form a neighbor with your router" ? Nov 29, 2018 at 22:52
How you configure a router for BGP, or anything else, depends on the router model. You will enter explicit neighbors by the neighbor address. If you want to know how BGP works and what information is exchanged in what format, you should read RFC 4271, A Border Gateway Protocol 4 (BGP-4). That RFC explains it all.– Ron Maupin ♦Nov 29, 2018 at 22:59
(deleted my own comment - wrong subthread, sorry) Nov 29, 2018 at 23:48
If you're talking about something like RIPE does in their RIS Project, then yes, it becomes possibe to gather information from others via BGP using tcp/179.
Ripe invite participants to peer with a (set of) their "RIS Collectors" and announce all of their prefixes to RIPE (without announcing any prefixes from their collectors to participants, essentially being listening-only BGP speakers): See https://www.ripe.net/analyse/internet-measurements/routing-information-service-ris/ris-peering-policy
Still, a BGP router will not talk BGP (tcp/179) nor divulge any routing information via BGP to "someone else" (and much less "anyone else") unless (mis)configured explicitely to do so.
A router may offer other means to access current internal information (like the BGP table or the routing table, list of configured BGP neighbors and their state as seen by the given router), for example via SNMP, but that's a different story.