Transparent Redirection of Network Sockets 1



Similar documents
Transparent Redirection of Network Sockets 1

Network Communication

Transport Layer Protocols

Building a Multi-Threaded Web Server

1 An application in BPC: a Web-Server

Protocol Data Units and Encapsulation

Division of Informatics, University of Edinburgh

Limi Kalita / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (3), 2014, Socket Programming

Objectives of Lecture. Network Architecture. Protocols. Contents

How To Make A Vpc More Secure With A Cloud Network Overlay (Network) On A Vlan) On An Openstack Vlan On A Server On A Network On A 2D (Vlan) (Vpn) On Your Vlan

CPS221 Lecture: Layered Network Architecture

Lesson: All About Sockets

Improved Digital Media Delivery with Telestream HyperLaunch

Ethernet. Ethernet. Network Devices

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Integrating the Internet into Your Measurement System. DataSocket Technical Overview

Communication. Layered Protocols. Topics to be covered. PART 1 Layered Protocols Remote Procedure Call (RPC) Remote Method Invocation (RMI)

04 Internet Protocol (IP)

ETM System SIP Trunk Support Technical Discussion

How To Write A Network Operating System For A Network (Networking) System (Netware)

Datagram-based network layer: forwarding; routing. Additional function of VCbased network layer: call setup.

The OSI model has seven layers. The principles that were applied to arrive at the seven layers can be briefly summarized as follows:

Green Telnet. Making the Client/Server Model Green

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

Operating Systems Design 16. Networking: Sockets

Report of the case study in Sistemi Distribuiti A simple Java RMI application

Question: 3 When using Application Intelligence, Server Time may be defined as.

Dissertation Title: SOCKS5-based Firewall Support For UDP-based Application. Author: Fung, King Pong

High Performance Cluster Support for NLB on Window

Chapter 11. User Datagram Protocol (UDP)

Learning Outcomes. Networking. Sockets. TCP/IP Networks. Hostnames and DNS TCP/IP

Transport layer protocols. Message destination: Socket +Port. Asynchronous vs. Synchronous. Operations of Request-Reply. Sockets

PROFESSIONAL. Node.js BUILDING JAVASCRIPT-BASED SCALABLE SOFTWARE. Pedro Teixeira WILEY. John Wiley & Sons, Inc.

Basic Networking Concepts. 1. Introduction 2. Protocols 3. Protocol Layers 4. Network Interconnection/Internet

Application Description

Computer Network. Interconnected collection of autonomous computers that are able to exchange information

Java Network. Slides prepared by : Farzana Rahman

基 於 SDN 與 可 程 式 化 硬 體 架 構 之 雲 端 網 路 系 統 交 換 器

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

First Midterm for ECE374 03/09/12 Solution!!

RARP: Reverse Address Resolution Protocol

VPN. Date: 4/15/2004 By: Heena Patel

Final for ECE374 05/06/13 Solution!!

SFWR 4C03: Computer Networks & Computer Security Jan 3-7, Lecturer: Kartik Krishnan Lecture 1-3

WAN Data Link Protocols

Socket Programming. Announcement. Lectures moved to

Computer Networks Practicum 2015

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents

Proxy Server, Network Address Translator, Firewall. Proxy Server

Application Development with TCP/IP. Brian S. Mitchell Drexel University

Computer Networks UDP and TCP

Transport and Network Layer

Chapter 8 Router and Network Management

Data Center Migration Lift and Shift Use Case Scenario

Model 2120 Single Port RS-232 Terminal Server Frequently Asked Questions

Comparing Microsoft SQL Server 2005 Replication and DataXtend Remote Edition for Mobile and Distributed Applications

Highly Available AMPS Client Programming

IMPLEMENTATION OF AN AGENT MONITORING SYSTEM IN A JINI ENVIRONMENT WITH RESTRICTED USER ACCESS

A Tool for Evaluation and Optimization of Web Application Performance

It is the thinnest layer in the OSI model. At the time the model was formulated, it was not clear that a session layer was needed.

Internet Control Protocols Reading: Chapter 3

Protocols and Architecture. Protocol Architecture.

1 Organization of Operating Systems

Chapter 6, The Operating System Machine Level

A Java Based Tool for Testing Interoperable MPI Protocol Conformance

Network Layers. CSC358 - Introduction to Computer Networks

Chapter 1 - Web Server Management and Cluster Topology

COMMMUNICATING COOPERATING PROCESSES

Large-Scale TCP Packet Flow Analysis for Common Protocols Using Apache Hadoop

Chapter 3. Internet Applications and Network Programming

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions

We will give some overview of firewalls. Figure 1 explains the position of a firewall. Figure 1: A Firewall

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

EITF25 Internet Techniques and Applications L5: Wide Area Networks (WAN) Stefan Höst

20-CS X Network Security Spring, An Introduction To. Network Security. Week 1. January 7

Mobile Computing/ Mobile Networks

Agenda. Network Programming and Java Sockets. Introduction. Internet Applications Serving Local and Remote Users

Quick Start for Network Agent. 5-Step Quick Start. What is Network Agent?

Effects of Filler Traffic In IP Networks. Adam Feldman April 5, 2001 Master s Project

LAB THREE STATIC ROUTING

Level 2 Routing: LAN Bridges and Switches

Japan Communication India Skill Development Center

TCP/IP Support Enhancements

How Does Ping Really Work?

Socket Programming in Java

Java Interview Questions and Answers

Introduction to Computer Networks

I/O Device and Drivers

In: Proceedings of RECPAD th Portuguese Conference on Pattern Recognition June 27th- 28th, 2002 Aveiro, Portugal

McAfee Web Gateway 7.4.2

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

Data Link Layer(1) Principal service: Transferring data from the network layer of the source machine to the one of the destination machine

First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

1. The Web: HTTP; file transfer: FTP; remote login: Telnet; Network News: NNTP; SMTP.

FINS Gateway For OMRON PLCs

Project 4: (E)DoS Attacks

SSC - Communication and Networking Java Socket Programming (II)

Clustering with Tomcat. Introduction. O'Reilly Network: Clustering with Tomcat. by Shyam Kumar Doddavula 07/17/2002

Transcription:

Transparent Redirection of Network Sockets Timothy S. Mitrovich, Kenneth M. Ford, and Niranjan Suri Institute for Human & Machine Cognition University of West Florida {tmitrovi,kford,nsuri@ai.uwf.edu. Introduction and Motivations A major concern for mobile agents is access to non-mobile resources. When an agent moves from one host to another, resources such as sockets and files that the agent may have been using on the source host are not available to the agent on the destination host. This complicates the task of the agent designer since the designer has to make sure that access to all non-mobile resources are terminated prior to the agent migrating. Furthermore, access to the same resources may have to be reestablished when the agent reaches the destination host. This problem becomes even more difficult when the mobility of the agent is not requested synchronously by the agent, but asynchronously by the system. An example is the notion of forced mobility in the NOMADS mobile agent system [], where the system may move agents between hosts for purposes of load balancing, hosts shutting down, etc. In such cases, it is extremely difficult and tedious to design the agent to terminate and reestablish access to non-mobile resources. This paper describes a mechanism to transparently redirect network communication in the event of agent migration. The system s goal is to allow agents to open network socket connections to other systems and then to be able to move between hosts without having to interrupt, disconnect, and reconnect any connections. This mechanism greatly simplifies the task of a mobile agent designer. In addition, when agents need to be forcefully moved (as in the NOMADS system), the system may do so assuming that the agent s network connections will continue uninterrupted. 2. s Overview The s API consists of 00% pure Java code. Because the implementation uses no native code, it is a cross platform API and can be used by any Java.2 compliant VM. Any agent that wishes to use a does so in a manner similar to using the Java sockets API. The agent must first instantiate a by providing the remote address and port number to the constructor. Once connected, the agent must use the input and output streams provided by the to send and receive data. At any point the may be suspended by the agent system so that the agent can migrate. After the migration has completed the agent system will cause each being used by the agent to resume its normal operation. The suspend and resume operations are transparent to agents reading from and writing to s. The following NOMADS Agent, in Figure, is an example of how to use the s API. In this example a is created and used to read text data from a server that is also using s. The agent enters an infinite loop reading one line of data from the and then migrating to a new host. Figure 2 illustrates the example. This research is supported in part by DARPA s Control of Agent-Based Systems (CoABS) program and NTA/NIMA.

3. s Implementation ing and resuming a requires that additional control information be sent over the network beyond what is required for normal network communications. The information is necessary so that both ends of a connection can coordinate the suspend and resume process so that no data is lost. There are many potential ways to exchange additional control information between s. However, as mentioned above, the current implementation is in Java, which gives the programmer no access to the underlying transport layer. With this restriction there are two obvious solutions: segment the data so that control information can be sent over the same socket as the user data, or use a separate control socket for each connection (similar to the ftp protocol). If the data is segmented then much of the benefit of using TCP sockets is wasted since TCP also segments the data. If a separate control socket is used, then for each there are two underlying Java sockets. The method of implementation chosen is a variation of the second solution mentioned above. In the current implementation, all s running in a given VM share one control socket. Control public class ReceiverAgent extends Agent { public static void main (String[] args) { try { m = new ( orion.coginst.uwf.edu, 8765); BufferedReader br = new BufferedReader (new InputReader (m.getinput())); System.out.println ("Receiving numbers..."); while (true) { System.out.println (br.readline()); go ( vega.coginst.uwf.edu, 3280, anonymous, guest ); System.out.println (br.readline()); go ( andromida.coginst.uwf.edu, 3280, anonymous, guest ); catch (Exception x) { x.printstacktrace(); Figure : Code example using s Agent andromida.coginst.uwf.edu Agent 2 Agent orion.coginst.uwf.edu vega.coginst.uwf.edu Figure 2: Example of Agent Mobility with s 2

information is sent from a on one host to a central message processing point on the remote host. That information is then relayed to the appropriate VM and finally delivered to the appropriate. This method alleviates the need to segment the user data, while only incurring a one-socket penalty per VM and one extra socket for the host s central message processing point. The s implementation consists of 3 major components:?? NodeController: A separate program running on each host using s. It acts as a single entry point for control messages per host?? VMController: A separate thread running in each VM using s. It acts as a single entry point for control messages per VM.?? s API: The set of classes available to user code for mobile sockets The remainder of this paper will discuss the implementation of the components shown in Figure 3. 3. The is a standalone program that runs on every host using s. It acts as a single point of entry for all control and query messages pertaining to s being used by agents running on that host. When messages arrive the will determine which VM the message should be sent to and then passes the message along to the to be delivered to the destination. Any replies are sent back to the, which are then passed back to the original sender. When several VMs on a given host need to use s, it is necessary to execute the as a separate program since it acts as the single control point for all s being used on a host. If the was run in a VM using s and that VM quit normally then all other VMs using s would no longer be able to receive control messages. If only one VM will be using s on a given host, the can be run as a separate thread inside that VM. 3.2 The serves two purposes: it receives all incoming control messages and delivers them to the appropriate, and it suspends and resumes all s when an agent wishes to migrate. A runs on any VM using s. It runs as a separate thread that gets started when the User Code Server s Control VM Update Control And Query VM Update Control Node Controller External Program VM Controller s Input Output Control messages messages Raw Data Only messages Control Java VM Host Host 2 Figure 3: Relationship between the three major components Figure : Flow of control messages and user data 3

first or Server is created. The suspend and resume operations may be invoked by any piece of code that has been granted the appropriate permission. Usually this would be the agent system, but any piece of code can be authorized to suspend and resume s by setting the Java permissions in a Java security policy file. 3.3 s A encapsulates a normal TCP socket. All access to the underlying socket is done via wrapper methods in the class. The input and output stream of the TCP socket are also encapsulated by Input and Output respectively. By using wrapper classes, the underlying socket and its streams can be replaced transparently to the user when an agent migrates. Figure 5 shows the structure of the class. As mentioned above, all control information is delivered to a via a separate network connection. Because only user data is sent over the connection, a can communicate with normal TCP sockets. However, a that is connected to a normal TCP socket cannot be suspended. That must be closed prior to migration. Only connections between two s can be suspended and resumed. When a connects to another end-point it must determine whether or not that end-point is also a or if it is a normal TCP socket. Since a cannot be suspended if it is connected to a normal TCP socket, the remote end-point s type must be determined first before the agent has a chance to migrate. Figure 6 outlines the initialization process. 3.3. ing a A can be suspended in one of two ways: it can be suspended because the agent using the wishes to migrate (suspension was triggered locally) or it can be suspended because the other side of the connection needs to migrate (suspension was triggered remotely). When a connection is suspended, one end is always local and the other end is always remote. The procedure for suspending a differs depending on how it was triggered. If the was suspended locally, it will first contact the remote and tell it to suspend the other end of the connection. Next the will suspend the input stream. will Wrapper Methods for TCP Socket Input TCP Socket Output Network Traffic Input Output User Code Figure 5: structure

not return until all data has been read from the underlying stream and all threads reading from the stream have been put to sleep. After the input stream has been suspended the will suspend the output stream. Like Input.suspend(), Output.suspend() will not return until all threads writing to the stream have been put to sleep. Finally, before closing the underlying socket, the will record the remote address to which it was connected. Lastly the underlying socket connection is closed. If the was suspended remotely, it will first suspend the output stream. Next it will suspend the input stream. Finally it will close the underlying socket. When a connection is suspended it is important that the streams in one be closed opposite the order in which they are closed in the other. If the streams were suspended in the same order on both sides a deadlock will occur. By suspending the streams in the opposite order one input stream is always trying to finish reading while the corresponding output stream is trying to finish writing. Figure 7 illustrates the process of suspending a before an agent migrates. Server Registers Server queries 3 remote to determine connecting socket type 3 Queries Remote Node Controller to determine Server Socket Type Registers Server s are connected and IDs exchanged 2 Connects to Server Figure 6: initialization process Host Address = 92.68..0 Host Address = 92.68..00 I 2 O Socket Connection socketstate = SUSPENDED_LOCAL remoteaddress = 92.68..00 Set socket state Record remote address Close socket connection O 3 I socketstate = SUSPENDED_REMOTE Set socket state Close socket connection Figure 7: process 5

3.3.2 Resuming a A is resumed in one of two ways depending on how it was suspended. If the was suspended locally (i.e. it was suspended because the agent using the migrated) then it is responsible for initiating the resume. If the was suspended remotely (i.e. it was suspended because the remote agent migrated) then it must wait for the other side to initiate the resume process. If the being resumed was suspended locally, it will first contact the remote to find out what port it should use to resume the connection. The port used is the same port that the uses to deliver messages to the. By using this port, the VM Controller can receive the resume message and hand off the connection to the waiting to be resumed. Once the knows which port to use, it will contact the and send it a resume message. The will then hand off the connection to the appropriate on the remote side. Finally the will resume only its input stream. At this point the s are resumed. If the being resumed was suspended remotely, it will receive a TCP socket connection from the. The will keep this socket as its underlying socket connection and resume only its input stream. At this point the is resumed. The following diagram illustrates the process of resuming a after an agent has migrated. 3.3.3 s The two major components of the s API are the Input and Output s. They are important because they control how the data is actually sent using a. This section will describe some of the overall design decisions as well as the implementation of both the Input and Output streams. Since s wrap around normal TCP Sockets, it is desirable to take advantage of the benefits of TCP. One major benefit of TCP is that it will buffer data until it is read from the socket. Since the underlying socket buffers the data, the does not need to buffer data until it is suspended. Until the is suspended, calls to read and write can be mapped directly to the underlying socket. When a is suspended the output stream will flush all data pending on the TCP buffer. At the same time, the corresponding Input stream will buffer data from the socket until no more data is available. Host Address = 205.60.76.00 Host Address = 92.68..00 Query Port 2 Send Message socketstate = RESUMED remoteaddress = 92.68..00 Socket Connection I I 3 Hand off socket connection socketstate = RESUMED Figure 8: process 6

When the is resumed, the output stream will begin writing normally, and the input stream will map all calls to read to its internal buffer until it is empty. After the buffer is emptied it will map all calls to read directly to the socket again. Another benefit of TCP is that it will segment data and make sure that if the data arrives at its destination, the data will be delivered correctly and in order. As mentioned earlier, if s choose to send control information on the same socket as the data it would be necessary to segment the data. Not only would s not be able to communicate with normal TCP sockets, they would be unnecessarily re-implementing something that TCP already does. Because TCP guarantees that if the data arrives at its destination, it will be delivered correctly and in order, streams can blindly read and write to the socket without worrying about segmenting the data to ensure correct, in-order delivery. The implementation was simplified by relying on some of the features that TCP provides, but blindly writing and reading to and from the socket causes a problem with mobility. There are two types of read and write methods, one that accepts one byte to be read or written and another that accepts an array of bytes to be read or written. When read or write is called on the underlying stream, that call will block until it has been satisfied. A cannot be suspended until all calls to the underlying read and write methods complete. If a call to read or write is made with a large array, it could be several minutes before the call is satisfied. It is usually not convenient for an agent to wait for several minutes before it can suspend all of its s. Therefore, the streams must break large arrays into smaller chunks and write one chunk at a time. After writing one chunk it will check to see if the stream has been suspended before writing the next one. Checking to see if the stream has been suspended after reading or writing a chunk can be inefficient depending on the chunk size. Currently the chunk size is set to 208 bytes. That size was chosen because it would allow a stream to check to see if it is suspended once each second on a 28.8 baud modem connection. If s are being used on a higher bandwidth connection this size should be adjusted to allow more data to be sent each time. The current implementation does not adjust the chunk size depending on the connection. The best way to optimize this feature would be to monitor how many bytes are being sent and increase/decrease the chunk size accordingly.. Related Work The s API is not the only project that is addressing transparent network redirection. As agent based systems grow in popularity, network transparency is becoming more and more desirable because it helps to greatly simplify solutions. As an example consider CBorg developed at the Vrije University in Brussels. CBorg is a mobile agent system that supports location independent addressing and message forwarding. CBorg accomplishes this by using a custom built router that doubles as a name server. Instead of sending lookup requests to the name server, entire messages are sent, and the name server will route the messages appropriately. Another example is FarGo developed by the Israel Institute of Technology. FarGo is a mobile code system that also supports location transparency via updating remote RMI references. The basic building blocks of a FarGo application are called complets. Complets can be interconnected via complet references, which can be local or remote (using RMI). A complet communicates by using these complet references to invoke methods on other complets. Each time a source or destination complet migrates, the FarGo system updates the references of affected complets so that they remain valid. 7

5. Future Work The s API is the first step towards a network redirectable socket for use with mobile agents. Some of the future enhancements include:?? Embeddable : The currently is implemented in Java and runs as a stand-alone application. It is required on any host that is using s. However, the implementation does not have to be in Java. It is possible to write the Node Controller in C or C++ and embed it as part of an agent system such as NOMADS.?? Mobility with normal TCP sockets: Currently s can be migrated when they are communicating with other s. s can also communicate with normal sockets, but when they do they loose the ability to migrate. A Proxy could be used to allow s to connect to normal sockets while still allowing the agent using the to move. The Proxy could be a standalone program or embedded in another application like the. The proxy would use s to communicate with the agent and normal TCP sockets to talk to the server and would act as a middleman for communication. 6. References [] O. Holder, I. Ben-Shaul, and H. Gazit. Dynamic Layout of Distributed Applications in FarGo. Online. Available: http://www.dsg.technion.ac.il/fargo [2] O. Holder, I. Ben-Shaul, and H. Gazit. System Support for Dynamic Layout of Distributed Applications. Online. Available: http://www.dsg.technion.ac.il/fargo [3] O. Holder and I. Ben-Shaul. Dynamic Layout of Distributed Applications. Online. Available: http://www.dsg.technion.ac.il/fargo [] N. Suri, J. M. Bradshaw, M. R. Breedy, P. T. Groth, G. A. Hill, and R. Jeffers. Strong Mobility and Fine-Grained Resource Control in NOMADS. Submitted for Publication: ASA/MA 2000 [5] W. Van Belle, K. Verelst, and T. D Hondt. Location Transparent Routing in Mobile Agent Systems Merging Name Lookups with Routing. Online. Available: http://progwww.vub.ac.be/poolresearch/cborg/papers.htm [6] W. Van Belle. Reinforcement Learning as a Routing Technique for Mobile Multi-Agent Systems. FTDCS 99. (998) 8