1. Trang chủ
  2. » Ngoại Ngữ

A social network based on android phones

116 157 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 116
Dung lượng 1,97 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

A SOCIAL NETWORK BASED ON ANDROID PHONES A Doctoral Dissertation Submitted to The School of Engineering In Partial Fulfillment for the Degree of Doctor of Computer Engineering By Tuan Vi

Trang 1

A SOCIAL NETWORK BASED ON ANDROID PHONES

A Doctoral Dissertation Submitted to The School of Engineering

In Partial Fulfillment for the Degree of Doctor of Computer Engineering

By Tuan Viet Le

Prepared Under the Direction of Dr Glen Qin

School of Engineering Northwestern Polytechnic University

47671 Westinghouse Dr., Fremont, CA 94539

August 2012

Trang 2

ii

Trang 3

iii

Trang 4

iv

ACKNOWLEDGMENTS

I owe my deepest gratitude to my advisor, Dr Glen Qin He gave many valuable counsels, and encouraged and guided me through these years In addition, I offer my sincerest thanks to my committee members, Dr Henry Chang and Dr David Li, for their time and advice

Lastly, I offer my regards and blessing to my parents, for their understanding and gracious support

Trang 5

v

ABSTRACT

With the improvement of the smartphone CPU, the smartphone is as powerful as a computer In other words, smartphones can run many applications that a computer does Therefore, in recent years, people have changed their habit of using computers and started using smartphones to access the Internet This trend has created a new direction in the software industry Software companies have built many mobile phone applications These applications are preferred to be implemented on the Android platform because of its availability, scalability, and convenience

The social network is a new trend of communication There are more and more people joining and sharing their information on social networks With smartphones, people can maintain their relationship with high convenience In order to reduce the communication cost of phones,

sharing information between phones using Peer-to-Peer networks is recommended

This project applies a Peer-to-Peer network model to share a file between Android smartphones The file sharing could be any type of format Furthermore, users also share the information in the database, such as a personal profile, contact list, current position, etc If the contact information

is inconsistent among the users, the application will automatically synchronize the contact

information based on the time stamps of the contact, assuming the most recent information is correct, or let the users decide which version is the correct information This application is an important step in building a fully functional social network based on Android mobile phones

Trang 6

vi

CONTENTS Section Page

ACKNOWLEDGMENTS iv 

ABSTRACT v 

CHAPTER ONE: INTRODUCTION 1 

1.1 The Concept 1 

1.2 Motivation 2 

1.3 Objectives 3 

1.4 Requirements 3 

1.5 Contributions 4 

1.6 Background 4 

1.6.1 Smartphone Definition 4 

1.6.2 Smartphone Operating System (OS) 4 

1.6.3 Firewall 12 

1.6.4 Network Address Translation (NAT) 14 

1.6.5 Unicast, Broadcast, Multicast 18 

1.6.6 Social Network 18 

1.6.7 Mobile Social Networking 18 

CHAPTER TWO: LITERATURE REVIEW 22 

2.1 P2P Overview 22 

2.1.1 Architecture of P2P 22 

2.1.2 P2P Characteristics 23 

Trang 7

vii

2.1.3 Types of P2P 24 

2.1.4 Popular P2P Application 26 

2.2 Peer-to-Peer Communication 27 

2.2.1 P2P Discovery 27 

2.2.2 The Peer-to-Peer Software Structure 32 

2.2.3 P2P File-sharing 33 

2.2.4 The Risk of P2P File Sharing 34 

2.2.5 The Issue of Direct Communication 34 

2.2.6 Communication between Peers over Firewall/NAT 34 

2.3 Peer-to Peer Protocols 39 

2.3.1 SIP 40 

2.3.4 Juxtapose (JXTA) 49 

CHAPTER THREE: RESEARCH DESIGN 50 

3.1 Research Design 50 

3.2 Why Android Platform 50 

3.3 Hardware and Software Consideration 51 

3.4 Protocol Used 52 

3.5 Application Development Process 52 

CHAPTER FOUR: IMPLEMENTATION AND RESULTS 66 

4.1 Application Implementation 67 

4.1.1 Node ID 67 

Trang 8

viii

4.1.2 Network Implementation 68 

4.1.3 Database Implementation 73 

4.1.4 Data Exchange Implementation 79 

4.1.5 Message Chatting Implementation 86 

4.1.6 File Exchange Implementation 88 

4.2 Results 96 

CHAPTER FIVE: SUMMARY AND FUTURE WORK 98 

5.1 Summary 98 

5.2 Future Work 101 

BIBLIOGRAPHY 103 

Trang 9

ix

LIST OF ILLUSTRATIONS Figure Page

Figure 1-1: Architecture of the Symbian Platform 5

Figure 1-2: iOS Architecture 8

Figure 1-3: Major Components of the Android Operation System 10

Figure 1-4: Network Topology Using a Firewall 14

Figure 1-5: Network Topology Using Network Address Translation 16

Figure 2-1: Server-Based Network and Decentralized Network 23

Figure 2-2: Pure P2P, Centralized Peer-to-Peer and Hybrid P2P System 26

Figure 2-3: Peer Discovery Using the Passive Method 28

Figure 2-4: Peers Using the Direct Discovery Technique 29

Figure 2-5: Indirect Discovery via a Rendezvous Peer 30

Figure 2-6: Discovery Propagation Chaos 31

Figure 2-7: Using TTL to Avoid Loopbacks 32

Figure 2-8: Message Traversing a Firewall/NAT 36

Figure 2-9: Message Traversing Two Firewalls/NATs 37

Figure 2-10: STUN Protocol 39

Figure 2-11: Mobility Register 41

Figure 2-12: Registrar Process 42

Figure 2-13: Session Establish 43

Figure 2-14: SIP Server 44

Trang 10

x

Figure 2-15: Message Transfers over Two Domains 46

Figure 2-16: Message Proxy with Record Routing 47

Figure 2-17: Redirect Server 48

Figure 3-1: Android OS Using Virtual Machine 53

Figure 3-2: Setting IP Address for Testing .54

Figure 3-3: Setup Android OS in VM 55

Figure 3-4: Start Android OS 56

Figure 3-5: Non GUI of Android OS 56

Figure 3-6: Connecting Two Android phones (VM) 56

Figure 3-7: Mobile Testing on a Wireless Network 57

Figure 3-8 NPU Android Project Architecture, the Hybrid Network 58

Figure 3-9: Entity Relationship Diagram 61

Figure 3-10: Add 54 Bytes at the Beginning of the Data File 64

Figure 3-11: File Receiving Process 65

Figure 4-1: Calculating Broadcast Address 69

Figure 4-2: Application Starts and Gets IP Address 71

Figure 4-3: Get Data Cache of Bootstrap .73

Figure 4-4: Edit a User Profile 76

Figure 4-5: Default Group Name and Custom Group Name .78

Figure 4-6: Import Data from NPU Project Database to Android Contact Database 79

Figure 4-7: Add New Profile 80

Trang 11

xi

Figure 4-8: Send Request Update Information 81

Figure 4-9: Invite Updates Information 81

Figure 4-10: Get New Data and Automatic Inserting 82

Figure 4-11: Manipulate One Data Row 82

Figure 4-12: Change Information at One Data Row 83

Figure 4-13 Update one data row 83

Figure 4-14 Alert receiving data contact .84

Figure 4-15: Choose Data in Case of Data Conflict 85

Figure 4-16: View Database after Update Data Conflict 85

Figure 4-17: Phone B Not Updates, even though Database of B is Different with A’s 86

Figure 4-18: Simple Message Chatting 88

Figure 4-19: Auto Highlight Old File Name 92

Figure 4-20: File Management 92

Figure 4-21: Sending/Receiving File between Phones 95

 

 

Trang 12

xii

LIST OF TABLES Table Page

Table 3-1: Message Exchange 63

Table 4-1: Example of default group name 77

Table 4-2: Data Row Contact 1 81

Table 4-3: Data Row Contact 2 81

Table 4-4: Check Data Conflict Algorithm 84

Trang 13

1

CHAPTER ONE: INTRODUCTION 1.1 The Concept

Communication is an indispensable requirement for humans People want to share information in

a small group, such as within a family or group of close friends Others want to talk with bigger groups for different purposes They want to join a class for better learning, or they want to join a marketing club for sharing sales experiences Linking an individual person into a group is

building a network, or social network Each person in the network is called a “node” These nodes can communicate with each other directly or indirectly With direct communication, people can have face-to-face meetings or make a phone call This formality is limited to time and suitable with small groups In order to share information within big groups, people often choose

an indirect way Fortunately, people can also build a social network by using Internet

technology, which has many conveniences for big groups

The most common way of indirect communication is that a user logs into a website and starts sharing information The information is normally stored and processed at a place, called the server side; the user side is called the client side This client/server model has advantages

because data is centralized at the server to reduce network traffic and is easy to maintain

However, it also requires building infrastructure, such as the host and domain name Because of this disadvantage, people use the Peer-to-Peer model In Peer-to-Peer model, each peer has its own data and equally privileged, equipotent participants in the network The Peer-to-Peer model does not need a system administrator

There are some famous typical social network services running on the client/server model, such

as Facebook, Twitter, or Linkedln On Facebook, the user can create a personal profile, add photos, short messages, and share to a group Whenever a user updates his/her information, the other users inside the group instantly get notified While Facebook is more focused on sharing pictures and finding people to provide a deep connection, Twitter centers on navigating,

updating, and linking to promote anything However, Linkedln is designed for posting resumes,

Trang 14

2

offering status updates of one’s latest accomplishments, or giving and receiving

recommendations in professional ways

While Facebook, Twitter and Linkedln are typical examples of applications that run on the client/server model, Bittorrent and Skype are mentioned as these typical examples of

applications that run on a Peer-to-Peer model At Bittorrent, the user can quickly and safely share files between peers Similarity, Skype allows user to send instant messages, share files, or make voice and video calls and chats Nowadays, these applications do not only run on computers but also on smart phones

In recent years, people have changed the way they go to the Internet There are more and more people using smart phones to access the Internet instead of using a desktop or laptop computer

“In 2011, combined shipments of smart-phones and tablets will overtake those of personal

computers”, (http://www.morganstanley.com/) Furthermore, one of the top developer

preferences and most popular mobile operating system is Android According to Gartner,

(http://www.gartner.com), in the third quarter of 2011, the Android operating system had 52.5 % compared with its next competitor, Symbian, which had 16.9%, of the smart phone market share With this new trend, the author will create and use a framework to send data between Android phones based on Peer-to-Peer architecture The project uses SIP and Sip2Peer, open source Peer-to-Peer to connect to the network, exchange messages, exchange file, and collaborate

independently on the underlying network topology Moreover, the author also makes an

application for a demo The application allows sharing data between phones An example is one phone can create a group and invite another phone to join the group Each phone can send uni-cast, multi-cast, or broadcast for getting addresses of others, sharing personal profiles of each user in-group, sharing data contact of all members in one company, chatting or sharing a file

1.2 Motivation

In recent years, more and more people spend time on mobile phones than on personal computers

In terms of application, when the need for mobile devices arises, the need for applications on

Trang 15

3

mobile devices increases as well This trend requires the software industry to focus on

applications running on mobile phones Moreover, people want to share personal information between phones with low cost and limited resources Likewise, the maintain group contacts is one application requested by user demand

This demand can be solved by using many techniques, such as P2P and client-server Each technique has its advantages and disadvantages For example, in the client-server model, data can

be centralized on the server side This helps people to easier maintain data and addresses security issues However, the client-server model requires extra cost for maintaining the host or

administrator work In contrast, a peer-to-peer model would be a good solution for these

problems The data is kept on each client instead of uploading data to a server In terms of shared data, the data will be downloaded whenever it is requested from another peer The researcher is motivated to study the idea of using mobile phones for exchange information on P2P network

1.4 Requirements

This project focuses on social networks with Android smart phones, so the project has to meet critical requirements First, the application can run well on real phone devices Second, the application has to operate stably when it runs with limited resources of phones (limited memory, CPU speed) Third, the application not only supports many types of methods for sending, such as broadcasting, multicasting or unicasting, but it also supports multiple methods of connection, such as Wi-Fi and telecommunication Fourth, the response time/update time has to be fast Fifth,

Trang 16

4

the application provides some sample groups and user group definitions with many policy

options Lastly, the application has to be user-friendly when people use one hand to control it

1.5 Contributions

The research is an important milestone toward the implementation of a mobile social network It establishes a solid framework for sharing information between Android phones on a hybrid peer-to-peer network architecture The outcome of this research is an application which can be used for exchanging and synchronizing contact information, sharing files on Android phones, and exchanging short messages using a platform

1.6 Background

1.6.1 Smartphone Definition

The smartphone is a mobile device which has the combined ability of a mobile phone and ability

of a personal digital assistant (PDA) A mobile phone has two main functions: make a phone call and text message A PDA has functions similar to a personal computer The combination of mobile phone and PDA create a smartphone that has mobile capacity as well as computer power

A modern smartphone, nowadays, has added many types of sensors, such as a camera and Global Positioning System (GPS) These additional features create a huge ability for smartphones

1.6.2 Smartphone Operating System (OS)

Similar to a personal computer, each smartphone needs an operating system in order to manage hardware resources, such as input output process, memory allocation, interrupt handling, file system management, or graphical user interface There are many operating systems for

smartphones, such as Symbian OS, Blackberry Os, iPhone Os, Android Os, and Windows

Mobile Os Each type of mobile device is run on a specific operating system The list below introduces short descriptions of these OS

Trang 17

5

1.6.2.1 Symbian OS

Symbian OS was first developed by Symbian Ltd, and then by Symbian Foundation Nokia, Sony Ericson, or Samsung mostly used this OS There are five main layers within the Symbian platform including: the Application Layer, Middleware Layer, OS Layer, Adaptation Layer, and Cellular Platform

Figure 1-1 Architecture of the Symbian Platform

The Applications Layer includes application-specific user interface and engine components, such

as the organizer application suite, multimedia applications, telephony, and applications for controlling device settings It is separated into two types of applications, normal application and supported interface application The normal application can access the functionality, extensibility

or customization The supported interface application can provide programmatic interfaces to normal application The Applications Layer uses these services provided by Middleware and OS layers

Trang 18

6

The Middleware Layer provides services to the application layer The functionality of this layer

is independent of UI and applications Furthermore, the middleware layer uses the abstracted services which are provided by the OS layer in order to independent of hardware

hardware-The Operating System (OS) Layer provides both higher-level OS services and low-level OS services The higher-level OS services include a full range of technology domains such as

communications, networking, graphics, multimedia and so on The low-level OS services include frameworks, libraries and utilities, which turn the abstracted hardware and OS mechanisms into a programmable interface

The Adaptation Layer integrates the generic platform software with the phone’s cellular

platform It is implemented by the device creators though reference implementations provided with the platform ( http://library.developer.nokia.com)

The Cellular Platform is the device-specific hardware and cellular software that performs the services required by the Symbian platform ( http://library.developer.nokia.com)

trackpad, and touchscreen

1.6.2.3 Windows Mobile OS

Trang 19

7

Windows Mobile OS is a proprietary mobile operation system developed by Microsoft for

smartphones and pocket PCs Windows Mobile was based on the Windows CE kernel, which provided a suite of basic applications, developed using the Microsoft Windows API In February

2010, Windows Mobile has not been continued Windows Phone is the successor of Windows Mobile However, Windows Mobile application cannot run on Windows Phone The new

generation is Windows Phone 8 (2012) The new mobile OS has the ability to encrypt the entire device, including the operating system and data files by using the Unified Extensible Firmware Interface (UEFI) secure boot protocol; Windows Phone 8 has improved app sandboxing in order

to be better protected from malware

1.6.2.4 iOS

iOS is a proprietary mobile operating system developed by Apple, Inc In the beginning, the iOS was named the iPhone OS The first iPhone OS was run on iPhone, which combined iPhone 2.5G quad band GSM and EDGE cellular phone in June 2007 In June 2009, iPhone OS was renamed to the iOS iOS has added more features to each new version For example, in 2008, it was the first time an Apple user could download and install third party applications by App Store

in iOs2 In 2009, iOS 3 added copy and paste functionality and iPad support One year later, iOS

4 provided 1500 new APIs for developers, supporting multitasking and added the GameCenter feature On June 6, 2011, Apple previewed iOS 5 iOS 5 introduced the Siri voice assistant and provided new cloud connectivity features In 2012, the iOS 6 was announced It is the first version to support Facetime and Passbook Facetime supports cellular networks and the ability to answer phone calls as video chats Passbook is a new service, which helps to store tickets, gift cards, and other documents in digital form

The iOS is programmed in C, C++, and Objective-C It has four abstraction layers, including Core OS Layer, Core Service Layer, Media Layer, and Cocoa Touch Layer

Trang 20

8

Figure 1-2 iOS Architecture

The Core OS layer works with a kernel environment, drivers, and the basic operating system on iPhone In more detail, it contains low-level features such as LibSystem, which supports

Threading (POSIX threads), Networking (BSD Sockets), File System Aaccess, Standard I/O, Bonjour and DNS Services, Locale Information Memory Allocation, and Math Computation

The second layer is the Core Service This layer provides service for applications use and

frameworks use The frameworks contain the Core Foundation framework, CFNetwork

framework, and Security framework The Core Foundation framework manages Collection data types, Application Bundle support, Data & Time management, Row Data management,

Preferences management, URL & Stream services, Thread & Run-loop, Port & Socket

communication CFNetwork framework manages BSD Sockets, FTP & HTTP(S)

communication, Bonjour Network services, DNS Host resolution, Encrypted SSL or TLS Last, Security framework controls Certificate & Key management, Generate Pseudo-random numbers, and Keychain

The next layer is the Media Layer This layer contains audio, video, and graphic technology First, the audio technologies include the Media Player framework, the AV Foundation

framework, OpenA and the Core Audio framework Second, the video technology provides several ways to play and record video content It includes the UIImagePickerController class in UIKit, the Media Player framework, the AV Foundation framework and Core Media Third, the graphics technologies are used for handling and drawing images It manages the application’s

Trang 21

1.6.2.5 Android

The word “Android” is formed by mixing “andr-”, meaning “man or male”, and the suffix “–eides”, meaning “alike or of the species” Thus, Android means, “being human” Android is not only a mobile operating system based upon the Linux kernel but also considered as a set of system programs This set of system programs can be cataloged into four different layers

• Application layer:

The Application layer is a set of core applications, such as browser, email client, SMS program, maps, calendar, contacts, and others All these applications are written by Java programming language Android has been supported in order for these applications to run simultaneously That means it is possible to listen to music while browsing the website

Trang 22

10

Figure 1-3 Major Components of the Android Operation System

• Application framework layer:

The application framework is a framework used to make a standard structure of an application for a specific operating system The Android Application framework contains some important components, such as Content Providers, Resource Manager, Notification Manager, Activity Manager, Windows Manager, View System, Package Manager, Telephony Manager, and

Location Manager First, Content Providers control the sharing of data from other applications

In addition, Content Providers are also used for reading and writing private data Second, a Resource Manager helps to manage the storing of strings and layout files and bitmaps Third, the Notification Manager enables one to tell something that has happened in the background, for example, alerts the user about events, status bar updates, flashing lights or vibrations Fourth, the Activity Manager manages the lifecycle of applications through various states started, running, in background, or killed Fifth, the Windows Manager provides standard UI policies such as a

Trang 23

or cell tower and Wi-Fi signals

• The libraries layer

Although Android applications are written by Java programming language, the available libraries are written in C/C++ program language These libraries will be called by Java interface Some important libraries are listed below:

9 System C library - a BSD, derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices

9 Media Libraries - based on Packet Video's Open-CORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG

9 Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications

9 LibWebCore - a modern web browser engine, which powers both the Android browser and an embeddable web view

9 SGL - the underlying 2D graphics engine

9 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D

software pasteurizer

9 FreeType - bitmap and vector font rendering

9 SQLite: SQLite is a powerful and lightweight relational database engine available to all applications

Trang 24

12

• The run time

Android runtime consists of a set of core libraries and the Dalvik Virtual Machine First, a set of core libraries offer most of Java standard libraries Second, Dalvik Virtual Machine translates from the application side to the operation system side Then, the translation code can be executed

by the operation system The advantage of Dalvik Virtual Machine is that the different programs

do not affect each other so that if there is an error crash on one program, it does not affect the whole system

• The kernel layer

Linux kernel is at the bottom of the hierarchy Currently, Android uses Linux kernel version 2.6.4 This layer allows managing the driver model and core system services In order to access the device in shell mode, users have to focus on the root-file system structure The root-file

system is using rootfs, whereas data and system are using YAFFS (Yet Another Flash File

System)

1.6.3 Firewall

A firewall is a system used to keep a network secure It is inserted between the private network and the Internet to control incoming data from the outside network or outgoing from the internal network Typically, a firewall analyzes the data packet and decides whether or not it passes through the package There are three types of firewalls They are the application-level firewall, the circuit-level firewall, and the packet-filter level

• Application level firewall (proxies)

The application level firewall works as a reply to application level traffic The process can be explained in four steps First, the user communicates with the gateway at the TCP/IP application level (such as Telnet or FTP) Second, the gateway requires the name of the remote host from the

Trang 25

13

user Third, after the gateway validates the user ID and authentication information, it contacts the application on the remote host Fourth, the gateway relays TCP segments containing the

application data between the two endpoints This type of firewall has both advantages and

disadvantages It is not only securer than the packet filter type, but it is also easy to log and audit all incoming traffic at the application level However, the additional processing overhead on each connection is considered a drawback in this type of firewall

• Circuit-lever firewall

The circuit level firewall operates at the transport layer of the protocol stack The main point of this type is that instead of allowing an end-to-end TCP connection, it makes two connections One between itself and the TCP user on an inner, the other is between itself and the user on an outside host Then, the gateway replays TCP segments from inside to outside connection or vice versa Last, the security functions will allow or deny the connection

• Packet-filter level firewall

A packet-filter router uses a set of rules to determine to pass through or discard incoming and outgoing IP packet These rules are based on information in a network packet such as source IP address, destination IP address, source and destination transport-level address, and IP protocol field and interface Packet filter firewalls are preferred because they not only have simplicity and are transparent to the user, but they also less cost for development and are fast However, they have many drawbacks For example, they cannot prevent attacks from application levels

Additionally, the authentication feature is rarely supported Moreover, they also limit the number

of logging functionalities

Trang 26

14

Figure 1-4 Network Topology Using a Firewall

1.6.4 Network Address Translation (NAT)

Network Address Translation (NAT) is the translation IP address within an internal network to different IP address on public network NAT works by modifying the IP address information in

IP packet headers while in transit across a traffic routing device NAT can be categorized into two types, static NAT and dynamic NAT With static NAT, there is a one-to-one mapping relationship between the internal IP address and external IP address However, in dynamic NAT, the set of internal IP addresses is mapped with a smaller set of external IP addresses

• NAT operation

NAT is implemented by a router or a firewall and is used for network protection by providing only a single point of entry into the private internal network In order to modify the IP package, the router does the following three steps:

1 It stores packet information, such as the source IP address and port number in the router’s translation table

Trang 27

3 The router forwards the modified packet to the external network Once the router receives the data packets from the external network, it inverses the mapping process by using the router’s translation table If the inverse process is successful, the data package can enter the internal network Otherwise, it is blocked

Trang 28

16

Figure 1-5 Network Topology Using Network Address Translation

NAT is preferred because it has many advantages For example, it is a technique for saving IP addresses (by mapping many internal network IP address with global unique IP addresses), thus,

98.10.10.5

IP package DSI: 98.10.10.5:80 SRC: 220.16.16.5: 12002

1. Internal machine initiates

connection to outside network 

via NAT router

2. The NAT router rewrites the headers. The router stores the  mapping from the internal to  the public IP address

3. An external client  responds to a connection  using the public IP address

Trang 29

17

it reduces the cost of a corporate network Besides, NAT also allows only a single point of entry into the internal network

• Types of NAT

1 Full Cone NAT (Static NAT)

Full Cone NAT is the simplest and least restrictive type of NAT It maps a public IP address and port to a LAN IP and port Any packet coming from outside may cross this NAT through the mapped NAT IP and port Thus, it is known as port forwarding For example: The internal client send socket with IP address: 192.168.1.11:5600 The NAT translates 192.168.1.11:5600 to 70.80.35.65:4321 Any user on the Internet who sends a packet to 70.80.35.65:4321 will be transmitted to 192.168.1.11:5600 by the NAT

2 Restricted Cone NAT (dynamic NAT)

A restricted cone NAT works similarly to a full cone NAT but applies additional restrictions based on an IP address The requirement is that the internal client has to send packets to an IP address (X) before X can reply the package back This type of Nat restricts only the IP address This means X can reply with a different port number

3 Port Restricted Cone NAT (Dynamic NAT)

“A port-restricted-cone NAT is one where the NAT binding is accessible by any remote host, although in this case the remote host must use the same source port address as the original port address that triggered the NAT binding” (www.cisco.com)

4 Symmetric NAT (Dynamic NAT)

“The NAT mapping refers specifically to the connection between the local host address and port number, and the destination address and port number and a binding of the local address and port

to a public side address and port” (www.cisco.com) Each time the local machine sends a packet

to a new pair (IP address: port number), a new translation is made

Trang 30

18

1.6.5 Unicast, Broadcast, Multicast

Unicast is communication between a single sender and a single receiver over a network

Broadcast is communication between a single sender and all connected receivers over a network Multicast is communication between one or many senders to a set of receivers, (there may be no receivers, or any other number of receivers) Unlike broadcast transmission (which is used on some local area networks), multicast clients receive a stream of packets only if they have

1.6.7 Mobile Social Networking

Mobile social networking is a form of social networking where individuals of similar interests connect with each other using the mobile phone This social network combines web-based and phone-based information in order to gather in one place Furthermore, by using a mobile phone,

it can combine voice and data devices for communication over networks including cellular

Trang 31

19

technology and private and public IP infrastructure Thus, the interactions between users can be implemented at anytime and anywhere Recently, some popular online social networks like Twitter, Friendster, and Facebook are considered as mobile social networking

Social Network Features

This section describes some main features of social networks

• Identity

This feature is used to identify a unique entity or resource This is considering the most

important part of the system There are many different methods for identity The common

method uses an email address The others use phone numbers or just a picture In fact, users can have more than one identity in a social network

• Profile

Profile data is basic information of an entity such as name, avatar, postal address, phone number, hobbies, religion, political orientation, past jobs, education history, etc Depend on setting

permissions, the profile data can be kept private or published to others Also, some social

networks use the profile as a factor for grouping or referencing users with similar interests

• Privacy

Users define who can access their data under some conditions

• Groups

For easier managing, users group particular people together The main part of group management

is the ability to control joining and leaving of users as well as making the standard for

communication between individuals For example, one user announces an event to all members

of the group, or just sends a private message to another user

Trang 32

20

• Private messages

Private messages are readable messages only by sender and recipient Private messages not only contain a simple text, but also can contain embedded media or links Currently, developers are researching remote private messaging by using PubSubHubbub with enabled streams

• Content sharing

The most distinct characteristic of these social networks are content sharing and sharing

information in real-time Sharing photos, video/audio or links are remarkable features of

Facebook, while sharing a short message and following the actions of users are the main points

of Twitter In order to get the content, users are categorized under pre-defined permissiond The popular protocol that supports a variety of types of sharing is OExchange OExchange

[OEXCHANGE] is an open specification for sharing rich content over the Web using URIs between social sites Moreover, this protocol also provides service for receiving data and

advertising by using XRD and WebFinger

• Activities

Users can do many activities on social networks, such as changing status, joining a group,

creating a blog post, uploading a picture, or announcing an event The total of all activities of a user is named “the stream” of that user The challenge of activities is that they are updated in real-time One well-known protocol supports exchanging and updating information in real-time

is PubSubHubbub [PuSH] The other protocols do not support real-time features, such as

Activity Stream and AtomPub Activity Streams help to encode machine-readable information about social activities, such as creating a new connection, posting a comment, etc Similar to Activity Stream, AtomPub [ATOMPUB] is also used for publishing and posting based on HTTP The combination of both AtomPub and Atom Syndication Format (ASF) provide interaction with content, especially in blogs and RSS

• Follow-up actions

Users can take follow-up an action on social networks, such as using “g+1”, “favorite” or “like” options There are some protocols that support this type of action, such as OpenLike and Salmon

Trang 33

21

OpenLike [OPENLIKE] is an open protocol to allow sharing of what people like in a simple and common way between web applications (http://openlike.org/), (e.g “like” button) In addition, Salmon [SALMON] is an open protocol to allow updating and integrating in both original source and feed aggregator Specifically, if an article appeared on 3 sites A (the source), B and C (the aggregates), then members of all 3 sites could see and contribute to a single thread of

conversation regardless of site they were viewing from.(Wikipedia, 2012)

• Search

Users can search for other people by keyword, such as name, location, interests, or profile

information However, the search results may not be accurate - it depends on data publishing and the search engine There are some popular search engines using social networks, such as Spokeo, Google social search, Social Mention, Wink, WhosTalkin.com, Sightix, and yoName

• Data Portability

Currently, no popular social networking has supported data portability Data portability is registering user information such as user profile and contact list When a new social network is coming, the user could import its data in order to reuse previous contents, social graphs, or have similar authorization policies and privacy rules of the old social networking

Trang 34

centralized, decentralized, or even a mixed network

In some cases, each peer in the peer-to-peer communications model has both server and client capabilities A peer is a node or one unit of the P2P network There are three possible types of peers in any P2P network: simple peers, rendezvous peers, and router peers First, a simple peer

is designed to serve a single end user It provides services from its device and consuming

services provided by other peers Second, a rendezvous is a gathering or joining place A

rendezvous peer is often used to get resources, provide service on simple peers, or discover other peers Last, a router peer provides a mechanism for peers to communicate with other peers separated from the network by firewall or Network Address Translation (NAT) equipment A P2P network can have two or three types of the peers above

Trang 35

2 Networking

The P2P network is dynamic There are many connections within the network, but peers and their connections are volatile The peer enters and leaves the network “frequently” In addition, the availability of peers may vary considerably; some peers might be active for a long time while others are active only for a limited time P2P operates outside the domain name system (DNS) and often operate behind firewalls or NAT gateways

Trang 36

24

3 Interaction of Peers

All peers (node) in the P2P network are the same Each peer has combined client and server functionality, or called “SERVENT” (SERVer + cliENT) Thus, services provided by end systems and peers can collaborate directly with each other Therefore, there are minimal

demands of the underlying infrastructure

4 Management

There is no central control or centralized usage in a P2P network In other words, peer-to-peer systems are self-organized The peers have significant autonomy and similar rights This feature provides P2P network scalability

2.1.3 Types of P2P

P2P networks can generally be separated into two main categories, structured peer-to-peer network and unstructured peer-to-peer network

• Structured peer-to-peer network

With structured P2P, the network provides a specific algorithm and criteria on peers That is to say that during the network build up process, the structured network organizes a peer with a set

of rules of data items by the DHT (Distributed Hash Table) The complexity for reaching any node in structured P2P network is O(logN) where N is the number of participating The

structured P2P network can be divided into two types: DHT-Based and Hybrid P2P The main feature of DHT-based network is that it doesn’t have a central entity and the connections in the overlay are “fixed” Chord, CAN, and Kademlia are typical examples of this system The main feature of structured hybrid P2P network is that Peers are organized in a hierarchical manner

RecNet and Globase.KOM are typical examples of this system

Trang 37

25

• Unstructured peer-to-peer network

Unstructured P2P networks, for example Gnutella, are characterized by decentralized control and lack of a well-defined overlay topology In unstructured P2P, each peer is organized into a

random graph in flat or hierarchical manners In addition, there is no fixed limit for the number

of connections from one peer to other peers In order to discover a desired piece of data in the network, people use two normal strategies: flooding and random walks

The unstructured P2P network can divided into three types:

9 Pure peer-to-peer systems: In pure peer-to-peer, there is no central router Every node is a simple peer Peer establishes connections between each other randomly, and the peer can be removed without loss of functionality It is a total democratization of the peer group nodes Gnutella and FreeNet are typical examples of this system

9 Centralized peer-to-peer systems: This system has a central server, which is connected to all peers This central system is used for indexing functions, look upping /routing table or

providing other services Besides, peers can establish connection between each other Napster and Bittorent are typical example for this kind of system

9 Hybrid peer-to-peer systems: this system allows some functionality is still centralized The hybrid network has many super nodes to take on the role of a central index server These super nodes connect directly each other When a new node connects to network, it connects

to a single supper node This supper node responds query from initiating node, and forwards the query to other supper node KaZaA is a good example for this kind of system

Trang 38

BitTorrent client, BitTornado, and Azureus

Gnutella (2004) is a famous P2P file sharing protocol This protocol was a decentralized protocol for distributed search on a flat topology of peers Gnutella has no central server used for

coordination Gnutella defined five type of message for coordination and discovery of file

between peers: ping, ping response, client ping request, search, and search results All

connections between Gnutella peers use the TCP/IP protocol There are two types of peers in Gnutella network (version 0.6) One is leaf peer Another is super-peer (ultrapeer) This

separation is in order to get a higher performance for searching (forward query) Most popular Gnutella clients are LimeWire and Shareaza Both apps are open source software LimeWire supports sharing partial files with the partial file sharing option checked, and runs on a Java platform; Shareaze can run on a Windows platform

Trang 39

FastTrack is a well-known P2P file sharing protocol This network protocol is a semi-centralized network In the FastTrack network, these nodes are classified into two types: ordinary nodes and super-nodes (or higher-level node) Super-nodes act as temporary index servers FastTrack uses super-nodes in order to improve scalability FastTrack has a lot of client software, such as

KaZaA, Grokster and iMesh However, KaZaA is the most popular client

Trang 40

pre-28

discovered peers Based on this information, a peer can use services of other peers in the

network

This method is simple The advantage of this method is that it reduces network traffic However,

it also has drawbacks When information of the cache is out of date, the peer cannot use that information to reach other peers In this case, the peer should use the active discovery method

• Active method: The active method includes direct discovery and indirect discovery

Direct discovery:

A peer, the sender, sends broadcast or multicasting in the network All peers receiving the

broadcast message will return a message (could be the IP address) back to the sender The sender uses the information of the message-return to communicate directly with other peers

The advantage of this method is that there is up-to-date information in the network However, this discovery technique is limited to discover peers located on the LAN (local area network) In order to discover peers outside the local network, people must use the indirect discovery

technique

Figure 2-3 Peer Discovery Using the Passive Method

Ngày đăng: 14/05/2016, 09:24

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN