Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

Similar documents
Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Nixu Oy

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Trusteq Oy

COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC)

Socket Programming. CSIS0234A Computer and Communication Networks. Socket Programming in C

Systems software design NETWORK COMMUNICATIONS & RPC SYSTEMS

ECE 435 Network Engineering Lecture 2

ECE 435 Network Engineering Lecture 2

Elementary TCP Sockets

Unix Network Programming

CS118 Discussion 1B, Week 1. Taqi Raza BUNCHE 1209B, Fridays 12:00pm to 1:50pm

ICT 6544 Distributed Systems Lecture 5

Communication. Communication. Distributed Systems. Networks and protocols Sockets Remote Invocation Messages Streams. Fall /10/2001 DoCS

Lecture 5: Object Interaction: RMI and RPC

EECS122 Communications Networks Socket Programming. Jörn Altmann

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

CS307 Operating Systems Processes

Processes. Process Concept. The Process. The Process (Cont.) Process Control Block (PCB) Process State

Outline. Distributed Computing Systems. Socket Basics (1 of 2) Socket Basics (2 of 2) 3/28/2014

Outline. Operating Systems. Socket Basics An end-point for a IP network connection. Ports. Network Communication. Sockets and the OS

Outline. Distributed Computer Systems. Socket Basics An end-point for a IP network connection. Ports. Sockets and the OS. Transport Layer.

CS321: Computer Networks Introduction to Application Layer

Sockets. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

A Client-Server Exchange

Piotr Mielecki Ph. D.

Tutorial on Socket Programming

Hybrid of client-server and P2P. Pure P2P Architecture. App-layer Protocols. Communicating Processes. Transport Service Requirements

How do we Communicate? Introduction to Unix Network Programming. What does Alice do? What does Bob do? Two simplest networking programs

The BSD UNIX Socket Interface (CS 640 Lecture) Assignment 1. Interprocess Communication (IPC) Work Individually (no groups)

Hyo-bong Son Computer Systems Laboratory Sungkyunkwan University

SOCKETS. COMP750 Distributed Systems

Lecture 24. Thursday, November 19 CS 375 UNIX System Programming - Lecture 24 1

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

UNIX Network Programming. Overview of Socket API Network Programming Basics

PA #2 Reviews. set_name, get_name, del_name. Questions? Will be modified after PA #4 ~

UNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E.

Department of Computer Science

Network Programming and Protocl Design. Nixu Ltd.

Socket Programming TCP UDP

UNIX System Programming Lecture 19: IP Sockets

Sockets 15H2. Inshik Song

RPC Paradigm. Lenuta Alboaie Andrei Panu

Oral. Total. Dated Sign (2) (5) (3) (2)

A Socket Example. Haris Andrianakis & Angelos Stavrou George Mason University

CS321: Computer Networks Socket Programming

Context. Distributed Systems: Sockets Programming. Alberto Bosio, Associate Professor UM Microelectronic Departement

CLIENT-SIDE PROGRAMMING

Distributed Environments. CORBA, JavaRMI and DCOM

A Report on RMI and RPC Submitted by Sudharshan Reddy B

Ports under 1024 are often considered special, and usually require special OS privileges to use.

Client Server Computing

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

1.264 Lecture 16. Legacy Middleware

Programming with TCP/IP. Ram Dantu

Network Programming in C. Networked Systems 3 Laboratory Sessions and Problem Sets

Cloud Computing Chapter 2

Lecture 2. Outline. Layering and Protocols. Network Architecture. Layering and Protocols. Layering and Protocols. Chapter 1 - Foundation

(9A05803) WEB SERVICES (ELECTIVE - III)

CSC209H Lecture 9. Dan Zingaro. March 11, 2015

Lecture 06: Distributed Object

DS 2009: middleware. David Evans

UNITE 2006 Technology Conference

Distributed Objects. Object-Oriented Application Development

UNITE 2003 Technology Conference

Distributed Systems Question Bank UNIT 1 Chapter 1 1. Define distributed systems. What are the significant issues of the distributed systems?

Overview. Communication types and role of Middleware Remote Procedure Call (RPC) Message Oriented Communication Multicasting 2/36

Network Programming in C: The Berkeley Sockets API. Networked Systems 3 Laboratory Sessions

Introduction to Computer Systems. Networks 2. c Theodore Norvell. The Sockets API

The Berkeley Sockets API. Networked Systems Architecture 3 Lecture 4

Session NM056. Programming TCP/IP with Sockets. Geoff Bryant Process software

Chapter 4 Communication

Chapter 4 Interprocess Communication. Copyright 2015 Prof. Amr El-Kadi

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Process. Program Vs. process. During execution, the process may be in one of the following states

CS153: Communication. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

CSE 124 Discussion Section Sockets Programming 10/10/17

Distributed Systems. 02. Networking. Paul Krzyzanowski. Rutgers University. Fall 2017

Implementing Remote Procedure Calls*

Socket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory

Socket Programming. Dr. -Ing. Abdalkarim Awad. Informatik 7 Rechnernetze und Kommunikationssysteme

Client-server model The course that gives CMU its Zip! Network programming Nov 27, Using ports to identify services.

Chapter 3: Client-Server Paradigm and Middleware

Communication. Distributed Systems Santa Clara University 2016

Internet applications

UNIT IV- SOCKETS Part A

Lecture 15: Frameworks for Application-layer Communications

Lecture 15: Frameworks for Application-layer Communications

Randall Stewart, Cisco Systems Phill Conrad, University of Delaware

Introduction to Web Services & SOA

Review. Preview. Closing a TCP Connection. Closing a TCP Connection. Port Numbers 11/27/2017. Packet Exchange for TCP Connection

Topics for this Week

Lecture 3 Overview! Last Lecture! TCP/UDP and Sockets introduction!

CSE 333 Lecture network programming intro

JXTA TM Technology for XML Messaging

Applications and Layered Architectures. Chapter 2 Communication Networks Leon-Garcia, Widjaja

UNIT 1 TCP/IP PROGRAMMING CONCEPTS

Simple network applications using sockets (BSD and WinSock) Revision 1 Copyright Clifford Slocombe

Integrating Legacy Assets Using J2EE Web Services

Diagram of Process State Process Control Block (PCB)

Transcription:

Network Programming Samuli Sorvakko/Nixu Oy Telecommunications software and Multimedia Laboratory T-110.4100 Computer Networks October 9, 2006

Agenda 1 Introduction and Overview Introduction 2 Socket Programming Overview Client sockets Server sockets Sockets recap 3 Higher-level interfaces RPC Java RMI CORBA Microsoft s offerings Web Services 4 Final thoughts Security Discussion

Introduction Introduction 1 Introduction and Overview Introduction 2 Socket Programming Overview Client sockets Server sockets Sockets recap 3 Higher-level interfaces RPC Java RMI CORBA Microsoft s offerings Web Services 4 Final thoughts Security Discussion

Introduction Overview Wide-area concurrency Two or more entities Client-server, peer-to-peer, unidirectional or bidirectional multicast, broadcast,... Multiple levels of information exchange

Introduction Managing complexity Well-known protocols Layering Modularization / compartmentalization

Socket Programming 1 Introduction and Overview Introduction 2 Socket Programming Overview Client sockets Server sockets Sockets recap 3 Higher-level interfaces RPC Java RMI CORBA Microsoft s offerings Web Services 4 Final thoughts Security Discussion

Overview Overview The UNIX way Introduced in 1983 (4.2 BSD Unix) Bind together software and the communication channels they use

Overview Overview cont d. Bind together four items: Remote host address Remote host port number Local host address Local host port number Also additional information: Socket protocol (Local, IPv4, IPv6, IPX, X25,...) Communication type (Stream, datagram, raw,...) Other options (blocking/non-blocking, keepalive,...)

Client sockets Client sockets Create a socket (binding it to a file descriptor) Connect the socket with the other party int sockfd=socket(pf_inet, SOCK_STREAM, 0)) connect(sockfd, (struct sockaddr *) &remoteaddr, sizeof(struct sockaddr));

Client sockets Client sockets cont d. Of course need to verify return values The remoteaddr struct needs to be filled sin_family (AF_INET) sin_port (generally via htons()) sin_addr (usually from hostent struct from gethostbyname())

Server sockets Server sockets A bit more complicated than the client Again, socket needs to be created Then bound to desired protocol, port and listening address After that, indicate willingness to listen to the OS Now ready to accept connections int sockfd=socket(pf_inet, SOCK_STREAM, 0)) bind(sockfd, (struct sockaddr *) &myaddr, sizeof(struct sockaddr)); listen(sockfd, backlog); sin_size=sizeof(struct sockaddr_in); incoming_fd=accept(sockfd, (struct sockaddr *)&remote_addr, &sin_size);

Server sockets Server sockets cont d. What is usually done here is to fork() a child process New connections can be accepted as quickly as possible Old connections are served by the childs asynchronously The remoteaddr struct needs to be filled sin_family (AF_INET) sin_port (generally via htons()) sin_addr (usually from hostent struct from gethostbyname()) Other keywords: select(2), poll(2)

Sockets recap Sockets recap Examples were for TCP sockets, UDP similar Very simplified examples, don t do it like this :) What is sent over the socket is decided by programmer Actual communication is handled by OS, socket operations are syscalls

Higher-level interfaces 1 Introduction and Overview Introduction 2 Socket Programming Overview Client sockets Server sockets Sockets recap 3 Higher-level interfaces RPC Java RMI CORBA Microsoft s offerings Web Services 4 Final thoughts Security Discussion

RPC Remote Procedure Call Developed by Sun Microsystems Originally for NIS and NFS Defines a data representation for binary information (byte orders!)

RPC Remote Procedure Call cont d. Uses a portmapper portmap/rpcbind instead of direct communication RPC server opens up a free UDP or TCP port and registers with portmapper RPC client contacts portmapper and gets exact location of serer Also contains some options for authentication etc.

RMI Java Remote Method Invocation Also developed by Sun Microsystems Provides a way for Java object invocation from other Java VMs Supports object serialization

RMI Java Remote Method Invocation cont d Remote end: Export interfaces public interface MyInterface extends Remote{} Comms failures will be reported with RemoteException Creates instance(s) of a remote object Register the object(s) with RMI remote object registry Local end: Request the object from the remote server, which returns a Stub instance Methods invoked on the stub are run on the server, with RMI serializing and deserializing the communication

CORBA CORBA Common Object Request Broker Architecture Vendor-independent way for remote objects Specified by Object Management Group (OMG...) IDL, Interface Definition Language describes exported interfaces Similar to RMI in principle Mappings exist for C, C++, Java, COBOL, Lisp, Python...

CORBA CORBA cont d Interface is well separated from the implementation CORBA is well suited for middleware ( glue ) tasks Allows for access contror on object level

DCOM Microsoft s offerings Distributed Component Object Model (DCOM) Based on local COM, with added RPC, serializing and garbage collection functionality.net Remoting Part of the.net framework Will be superseded by Windows Communication Foundation in Vista Idea here is exactly the same as in CORBA et al, remote invocation of procedures or methods in objects.

Webserv Web Services Leverage the power of the Web Machine-to-machine communication SOAP: Extensible, XML-based communication over HTTP WSDL: Interface description language UDDI (Universal Description Discovery and integration): Publishing and discovery of Web services Can be used in many ways; RPC emulation, Service-oriented architecture (SOA), Representational State Transfer (REST)

Webserv Web Services AJAX (Asynchronous JavaScript and XML) could also be categorized as a web service Not strictly machine-to-machine User s browser may do operations without interaction Data exchange between server and browser Only a part of the web page is refreshed Communication with XMLHttpRequests (or IFrames) Not a standard or a technology, describes functionality

Final thoughts 1 Introduction and Overview Introduction 2 Socket Programming Overview Client sockets Server sockets Sockets recap 3 Higher-level interfaces RPC Java RMI CORBA Microsoft s offerings Web Services 4 Final thoughts Security Discussion

Security Security Cannot trust the network Client cannot trust server Server must not trust client What this boils down to is.. Use ready and tested protocol implementations if possible Use well-known protocols if possible Design protocols with security on mind from the start Always test for robustness, not only compliance What happens to a server if a client sends it e.g. \0 s, SQL statements, very large amounts of data... Input validation, application logic validation (e.g. state machines)

Security Further reading Richard Stevens: UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI, Prentice Hall, 1998, ISBN 0-13-490012-X man 2 socket, man 2 connect, man 2 bind and other UNIX man pages Sun Java RMI guides, http://java.sun.com/j2se/1.4.2/docs/guide/rmi/ Object Management Group CORBA FAQ and other documentation, http://www.omg.org/gettingstarted/corbafaq.htm Secure Programming for Linux and Unix HOWTO, http://www.dwheeler.com/secure-programs/

Discussion Discussion Comments? Remarks? Questions?