[go: up one dir, main page]

0% found this document useful (0 votes)
25 views4 pages

Peer-to-Peer Networking with Lidgren

This paper explores the use of the Lidgren network library for establishing peer-to-peer connections in .NET applications, focusing on content-based resource selection and document retrieval. It discusses the architecture, methodology, and code examples for setting up a peer-to-peer network, emphasizing the advantages of decentralized communication. The research highlights the challenges and potential of peer-to-peer information retrieval compared to centralized systems, aiming to contribute to the development of large-scale peer-to-peer web search engines.

Uploaded by

ap8.up
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

Peer-to-Peer Networking with Lidgren

This paper explores the use of the Lidgren network library for establishing peer-to-peer connections in .NET applications, focusing on content-based resource selection and document retrieval. It discusses the architecture, methodology, and code examples for setting up a peer-to-peer network, emphasizing the advantages of decentralized communication. The research highlights the challenges and potential of peer-to-peer information retrieval compared to centralized systems, aiming to contribute to the development of large-scale peer-to-peer web search engines.

Uploaded by

ap8.up
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

© 2014 IJEDR | Volume 2, Issue 1 | ISSN: 2321-9939

Establishing Connection between peers using


Lidgren network
Amrita Yadava
Department of Computer Science Engineering
Yagyavalkya Institute of Technology , Jaipur, India
[Link]@[Link]
________________________________________________________________________________________________________
Abstract— In this paper, we study the application of content-based resource selection and document retrieval to peer-to-
peer networks. Lidgren network is used as a library in .net framework. It makes easier to send and receive messages
between client and server. This network is used here to make the task easier. Peer to peer network is used to communicate
between several peers.

Index Terms— console, network, peer, retrieval

I. INTRODUCTION
One of the most common networking which have evolved in recent years to become one of the most popular means of data
retrieval is Peer to peer networking. This technology is used not only for client data sharing but now also for accessing large
repositories of data, software updates and multimedia streaming. The enormous growth of the amount of data stored in the P2P
overlays has made the existing methods of search in such overlays (which are usually limited to simple keyword search)
insufficient in terms of time and result efficiency.
The world wide web dominates search in the search engines. The search engines use many machines arranged in data centres
which they exclusively control. These machines helps in downloading many web pages as they can find, this process is referred to
as crawling, and index these documents. An index contains the documents in which the term occurred. With this information,
search engines can quickly suggest relevant pages for a given query. This approach of storing the index in large data centres and
performing the searches there is termed centralised search.
This paper presents the progress of the research in the field of Information retrieval. It describes the proposed methodology
and the preliminary results developed in research.
II. PEER TO PEER NETWORKING
In this paradigm each node is equal and therefore called a peer. Each peer could be said to be a client and a server at the same
time and thus can both supply and consume resources. In this paradigm, peers need to cooperate with each other, balancing their
mutual resources in order to complete application-specific tasks. For communication with each other, during task execution, the
peers temporarily form overlay networks: smaller networks within the much larger network they are part of.
Each peer is connected to a limited number of other peers: its neighbours. Peers conventionally transmit data by forwarding
from one peer to the next or by directly contacting other, non-neighbouring, peers using routing tables. Peers usually transmit data
by forwarding from one peer to the other or by directly contacting other, non-neighbouring, using routing tables.
The architecture is determined by the shape of overlay network that is the placement of indices, local or global, and the
methods used for communication. The choice of architecture influences how the network can be utilised for various tasks such as
searching and downloading. The participating machines in peer-to-peer networks are mostly found at the edge of the network
which are personal computers in homes.
This is the reason why a peer-to-peer network typically consists of many cheap rated machines and all with diverse processing
and storage space as well as different link speeds. This kind of network provides many valuable applications like streaming
media, file sharing, and distributed search. Peer-to-peer networks have numerous properties that make them useful for these tasks.
They have no centralised index or control point and therefore also no central point of failure. Because of this, they become self-
organising that is they can automatically adjust when peers join, depart from it or fail. The language used for communication
between peers is common among them and is symmetric as is the term of services. This symmetry is the reason of making a peer-
to-peer network as a self-scaling in which each peer that joins the network gets added to the available total capacity.

Construction of the NetPeerConfiguration object


Config = new NetPeerConfiguration("test_console");
[Link]([Link]);
[Link]([Link]);
[Link] essageType([Link]);
[Link]([Link]);
[Link] = [Link]("localhost");
The initialization of the NetPeer object (extremely simple) and starting up the
listener
thread:
Peer = new NetPeer(Config);

IJEDR1401094 International Journal of Engineering Development and Research ( [Link]) 528


© 2014 IJEDR | Volume 2, Issue 1 | ISSN: 2321-9939

[Link]();
[Link]("listening on " + [Link]());
NetWorker = new MyNetWorker(Peer, this);
NetThread = new Thread([Link]);
[Link]();

Sending a basic string message (the MessageType enum is my own, not part of the
framework):
public void SendMessage(string message) {
if ([Link] == null || [Link] == 0)
{
[Link]("No connections to send to.");
return;
}
NetOutgoingMessage msg = [Link]();
[Link]((int)[Link]);
[Link](message);
[Link](msg, [Link], [Link]
}

Sending peer info to all connected peers (by passing [Link] to


[Link]):
public void SendPeerInfo(IPAddress ip, int port) {
[Link]([Link]("Broadcasting {0}:{1} to all (count: {
[Link](), [Link]));
NetOutgoingMessage msg = [Link]();
[Link]((int)[Link]);
byte[] addressBytes = [Link]();
[Link]([Link]);
[Link](addressBytes);
[Link](port);
[Link](msg, [Link], [Link]
}

III. METHODOLOGY
In this networking, lidgren library is used.
Lidgren network library is all about messages. There are two types of messages:

Library messages telling you things like a peer has connected or diagnostics messages (warnings, errors) when unexpected
things happen.

Data messages which is data sent from a remote (connected or unconnected) peer.

The base class for establishing connections, receiving and sending message is the NetPeer class. You can use it to make a
peer-to-peer network, but if you are creating a server/client topology there are special classes called NetServer and NetClient.
They inherit NetPeer but set some defaults and include some helper methods/properties.

Here's how to set up a NetServer:

NetPeerConfiguration config = new NetPeerConfiguration("MyExampleName");


[Link] = 14242;

NetServer server = new NetServer(config);


[Link]();

The code above first creates a configuration. It has lots of properties you can change, but the default values should be pretty
good for most applications. The string you provide in the constructor (MyExampleName) is an identifier to distinguish it from
other applications using the lidgren library. Just make sure you use the same string in both server and client - or you will be
unable to communicate between them.
Secondly we've set the local port the server should listen to. This is the port number we tell the client(s) to connect to. The
local port can be set for a client too, but it's not needed and not recommended.
Thirdly we create our server object and fourth we Start() it. Starting the server will create a new network thread and bind to a
socket and start listening for connections.

IJEDR1401094 International Journal of Engineering Development and Research ( [Link]) 529


© 2014 IJEDR | Volume 2, Issue 1 | ISSN: 2321-9939

IV. RESULTS
Early on we spoke about messages; now is the time to start receiving and sending some. Here's a code snippet for receiving
messages:

NetIncomingMessage msg;
while ((msg = [Link]()) != null)
{
switch ([Link])
{
case [Link]:
case [Link]:
case [Link]:
case [Link]:
[Link]([Link]());
break;
default:
[Link]("Unhandled type: " + [Link]);
break;
}
[Link](msg);
}

Here first we declare a NetIncomingMessage, which is the type of incoming message. Then we read a message and handle it,
looping back as long as there are messages to fetch. For each message we find, we switch on something called MessageType - it's
a description what the message contains. In this code example we only catch those messages which are of
type VerboseDebugMessage, DebugMessage,WarningMessage and ErrorMessage. All those four types are emitted by the library
to inform about various events. They all contains a single string, so we use the method ReadString() to extract a copy of that
string and print it in the console.
Reading data will increment the internal message pointer so you can read subsequent data using the Read*() methods.
For all other message types we just print that they're currently unhandled.
Finally, we recycle the message after we're done with it - this will enable the library to reuse the object and create less garbage.
Sending messages are even easier:

NetOutgoingMessage sendMsg = [Link]();


[Link]("Hello");
[Link](42);
[Link](sendMsg, recipient, [Link]);

The above code first creates a new message, or uses a recycled message, which is why it's not possible to just create a message
using new(). It then writes a string ("Hello") and an integer (System.Int32, 4 bytes in size) to the message.
Then the message is sent using the SendMessage() method. The first argument is the message to send, the second argument is
the recipient connection - which we won't go into detail just yet - and the third argument are HOW to deliver the message, or
rather how to behave if network conditions are bad and a packet gets lo'st, duplicated or reordered.
V. CONCLUSION
Peer-to-peer technology is a robust solution to the ethical and technical problems and deserves more attention. an overview of
what has been done so far and what choices can be made when implementing a system in practice. Both of these aspects are
important for future research and development of real-world systems.
Peer-to-peer information retrieval overlaps with federated information retrieval, and shares its central challenges: resource
description, collection selection and result merging. However, the key difference is that in federated information retrieval all
queries and search results are channelled through a centralised mediator party. This enforces a strict division between the
consumers and providers of information. In peer-to-peer information retrieval the predominant mode of interaction is with other
peers, not with a centralised mediator. A number of key challenges for peer-to-peer networks with respect to usage guarantees,
behaviour of peers and evaluation are identified. Challenges unique and important to peer-to-peer information retrieval are
minimising latency, maintaining index freshness and developing test collections.
This paper gives a clear definition of peer-to-peer information retrieval and what distinguishes it from related and overlapping
fields, like file sharing and federated information retrieval. These concrete contributions may aid in the design and construction of
a large-scale peer-to-peer web search engine, which is the primary goal.

ACKNOWLEDGMENT
I thank all staff members of my college and friends for extending their cooperation during my research work.

REFERENCES

IJEDR1401094 International Journal of Engineering Development and Research ( [Link]) 530


© 2014 IJEDR | Volume 2, Issue 1 | ISSN: 2321-9939

[1] McGraw-Hill. 2002. McGraw-Hill Dictionary of Scientific and Technical Terms 6th Ed. McGraw-Hill Professional. ISBN
9780070423138.
[2] Zeinalipour-Yazti, D., Kalogeraki, V., and Gunopulos, D. 2004. Information Retrieval Techniques for Peer-to-Peer
Networks. Computing in Science & Engineering 6,
[3] Kulathuramaiyer, N. and Balke, W.-T. 2006. Restricting the View and Connecting the Dots - Dangers of a Web Search
Engine Monopoly. Journal of Universal Computer Science.
[4] White, A. 2009. Search Engines: Left Side Quality versus Right Side Profits. Working paper, Toulouse School of Economics.
Dec. http:// [Link]/10.2139/ssrn.1694869 (Retrieved June 25th 2012).
[5] Tene, O. 2008. What Google Knows: Privacy and Internet Search Engines. Utah Law Review 2008, 4, 1434–1490.
[6] Lewandowski, D., Wahlig, H., and Meyer-Bautor, G. 2006. The Freshness of Web Search Engine Databases. Journal of
Information Science 32, 2,131–148.
[7] Bergman, M. K. 2001. The Deep Web: Surfacing Hidden Value. Journal of Electronic Publishing 7.

IJEDR1401094 International Journal of Engineering Development and Research ( [Link]) 531

Common questions

Powered by AI

Using a decentralized, peer-to-peer network for large-scale information retrieval systems implies increased robustness and fault tolerance due to the absence of a central point of failure. It allows for greater scalability as each peer contributes to the network's total capacity. However, it also presents challenges such as maintaining index freshness and dealing with high latency due to the distributed nature of peers. Additionally, developing effective methods for resource description, collection selection, and result merging becomes crucial to handle the fragmented data across peers, posing ongoing research and implementation challenges .

Unique challenges in peer-to-peer information retrieval include minimizing latency, as there's no centralized index for quick look-ups, maintaining index freshness given the dynamic nature of the network, and developing test collections suitable for decentralized environments. Additionally, ensuring usage guarantees and dealing with the unpredictable behavior of peers are significant challenges compared to traditional web searches, which can rely on stable, centralized infrastructures .

Peer-to-peer networks inherently ensure self-organization and scalability through their decentralized nature. Each peer acts as both a client and a server, allowing the network to adjust dynamically when peers join or depart. The protocol automatically accommodates new peers into the network's capacity, maintaining an even distribution of resources and workload. This adaptability is facilitated by the lack of a centralized control point, allowing for flexible reconfiguration and continuous operation without central intervention .

Setting up a NetServer using the Lidgren network library involves creating a NetPeerConfiguration object with an identifier string to distinguish it from other applications. The server's local port is then set, which clients use to connect. Subsequently, a NetServer object is created and started, which initiates a network thread that binds to a socket and listens for connections. This process is significant because it allows the server to manage incoming and outgoing communications within the peer-to-peer network, ensuring efficient data exchange and network functionality .

The Lidgren network library simplifies message communication in peer-to-peer networks by providing a framework for sending and receiving messages between clients and servers. It supports various message types, including data messages and those for diagnostics, enhancing error handling and peer connectivity management. It allows for the creation of NetPeer objects for establishing connections and message transmission, streamlining the network setup, and enabling reliable communication even under poor network conditions by providing options like NetDeliveryMethod.ReliableOrdered .

In peer-to-peer information retrieval, the predominant mode of interaction is directly with other peers, eliminating the need for a centralized mediator. This setup allows for a more decentralized approach compared to federated information retrieval, where all queries and search results are channeled through a centralized mediator, enforcing a strict division between information consumers and providers. Additionally, peer-to-peer networks lack a central point of failure, allowing them to self-organize and scale as new peers join, whereas federated systems rely heavily on a central control point .

The architecture of a peer-to-peer network is determined by the shape of the overlay network and the placement of indices, which can be local or global. This architecture influences the efficiency and effectiveness of operations such as searching and downloading. For example, networks with a global index might provide faster search results by centralizing the indexing process, while local indices might enhance privacy and control. The lack of a centralized index also means that P2P networks can automatically adjust when peers join or leave, making them self-organizing. The architecture defines how data is transmitted between peers, using methods like forwarding or direct contact via routing tables, which significantly affects the network's performance .

Peer-to-peer networks avoid the issue of a central point of failure by eliminating centralized indexes and control points. Each peer in the network acts both as a client and a server, distributing the responsibilities of maintaining the network across all participants. This decentralization allows the network to remain operational and reorganize itself when peers suddenly join, leave, or fail. The architecture enables the network to be self-scaling, automatically integrating new peers into the available total capacity, making it robust against individual peer failures .

The Lidgren library handles various message types, including diagnostic messages such as VerboseDebugMessage, DebugMessage, WarningMessage, and ErrorMessage. These messages are crucial for maintaining network stability by informing developers of events and potential issues, allowing for timely debugging and troubleshooting. Data messages handle the actual data sent between peers, supporting robust and reliable communication. By recycling messages after processing, the library reduces garbage creation and improves network efficiency .

Symmetry in peer communication is important because it allows peers to interact as equals, facilitating mutual resource sharing and consumption. This symmetry enables networks to be self-scaling, as each new peer increases the total available capacity and supports seamless integration without disrupting existing communications. Furthermore, symmetric protocols help maintain uniformity in interactions, which is critical for network coherence and efficient resource allocation in peer-to-peer systems .

You might also like