Aalborg Media Lab 15-Jul-15 Java & EyesWeb Lecture 14 Java Client / Server Communication.

Slides:



Advertisements
Similar presentations
1 Ports and IPv6. 2 Ports Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP), used for communication Generally speaking, a computer.
Advertisements

Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
Socket Programming By Ratnakar Kamath. What Is a Socket? Server has a socket bound to a specific port number. Client makes a connection request. Server.
UDP and Multi-thread Socket Programming
Socket Programming.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
1 Java Networking – Part I CS , Spring 2008/9.
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Application Layer PART VI.
Network Programming. The biggest difficult part in networking programming lies in understanding networking not in using java networking package. Since.
An Introduction to Internetworking. Why distributed systems - Share resources (devices & CPU) - Communicate people (by transmitting data)
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L22 (Chapter 25) Networking.
Projekt współfinansowany przez Unię Europejską w ramach Europejskiego Funduszu Społecznego „Networking”
© Lethbridge/Laganière 2001 Chap. 3: Basing Development on Reusable Technology 1 Let’s get started. Let’s start by selecting an architecture from among.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 25 Networking.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
Networking with Java. Basic Concepts A Network exists when two or more computers are connected such that they can communicate data back and forth. There.
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
Socket Programming in Java -First Step of Network Programming-
Greg Jernegan Brandon Simmons. The Beginning…  The problem Huge demand for internet enabled applications and programs that communicate over a network.
Socket Programming -What is it ? -Why bother ?. Basic Interface for programming networks at transport level It is communication end point Used for inter.
Socket Programming References: redKlyde ’ s tutorial set Winsock2 for games (gamedev.net)
SOCKET PROGRAMMING. Client/Server Communication At a basic level, network-based systems consist of a server, client, and a media for communication as.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
Lector: Aliyev H.U. Lecture №14: Telecommun ication network software design for data bases and servers. TASHKENT UNIVERSITY OF INFORMATION TECHNOLOGIES.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Internet Applications and Network Programming Dr. Abraham Professor UTPA.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.

Establishing communication with Envirobat using TCP/IP Presented by Apourva Parthasarathy Date : 18/06/13.
 TCP (Transport Control Protocol) is a connection-oriented protocol that provides a reliable flow of data between two computers.  TCP/IP Stack Application.
Introduction to Network Programming with Sockets Network Programming Kansas State University at Salina.
RGEC MEERUT(IWT CS703) 1 Java Networking RGEC Meerut.
CSP Implementing a network 1 Implementing a network Lecturer: Smilen Dimitrov Cross-sensorial processing – MED7.
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
Chapter 2 Applications and Layered Architectures Sockets.
© Lethbridge/Laganière 2005 Chap. 3: Basing Development on Reusable Technology The Client-Server Architecture A distributed system is a system in.
1 Chapter 28 Networking. 2 Objectives F To comprehend socket-based communication in Java (§28.2). F To understand client/server computing (§28.2). F To.
1 Network Programming and Java Sockets. 2 Network Request Result a client, a server, and network Client Server Client machine Server machine Elements.
L 2 - 1 3( 1/ 20) : Java Network Programming. The Socket API The previous contents describe client-server interaction that application programs use when.
Introduction to Sockets “A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
Networking Terminology: ISP (Internet service provider) – dialup, dsl, cable LAN (local area network) IP (internet protocol) address, eg
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
Position of application layer. Application layer duties.
Java Sockets Tutorial Rahul Malik Nov 12, 2005.
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
Client/Server Socket Programming Project
Part 4: Network Applications Client-server interaction, example applications.
Socket Programming.
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
1 Lecture 9: Network programming. 2 Manipulating URLs URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on.
1 CSCD 330 Network Programming Fall 2013 Some Material in these slides from J.F Kurose and K.W. Ross All material copyright Lecture 8a Application.
Agenda Socket Programming The OSI reference Model The OSI protocol stack Sockets Ports Java classes for sockets Input stream and.
SOCKET PROGRAMMING WITH JAVA By Collin Donaldson.
Java’s networking capabilities are declared by the classes and interfaces of package java.net, through which Java offers stream-based communications that.
1 Network Communications A Brief Introduction. 2 Network Communications.
1 K. Salah Application Layer Module K. Salah Network layer duties.
Network Programming. These days almost all devices.
Socket Programming Ameera Almasoud
MCA – 405 Elective –I (A) Java Programming & Technology
Socket Programming Cal Poly Pomona Young CS380.
Network programming Lecture 1 Prepared by: Dr. Osama Mokhtar.
Presentation transcript:

Aalborg Media Lab 15-Jul-15 Java & EyesWeb Lecture 14 Java Client / Server Communication

Aalborg Media Lab 15-Jul-15 Interface to EyesWeb EyesWeb is able use a network connection as an interface to any program. EyesWeb is taking the role of the client making data available by sending it to a server ServerClient

Aalborg Media Lab 15-Jul-15 Networking Basics Computers running on the Internet communicate to each other using either the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP ). TCP provides a point-to-point channel for applications that require reliable communications. The UDP protocol provides for communication that is not guaranteed between two applications on the network.

Aalborg Media Lab 15-Jul-15 Ports & IP IP-addresses are used to identify the computer on the network. Ports are used by TCP and UDP to deliver the data to the right application. In connection-based communication such as TCP, a server application binds a socket to a specific port number.

Aalborg Media Lab 15-Jul-15 Sockets Server-Side A server runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request. On the client-side: The client knows the hostname of the machine on which the server is running and the port number to which the server is connected. To make a connection request, the client tries to rendezvous with the server on the server's machine and port.

Aalborg Media Lab 15-Jul-15 Sockets Server-Side If everything goes well, the server accepts the connection. Upon acceptance, the server gets a new socket bound to a different port. It needs a new socket (and consequently a different port number) so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client.

Aalborg Media Lab 15-Jul-15 Sockets Client-Side On the client side, if the connection is accepted, a socket is successfully created and the client can use the socket to communicate with the server. Definition: A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent.

Aalborg Media Lab 15-Jul-15 Sockets in Java The java.net package in the Java platform provides a class, Socket, that implements one side of a two-way connection between a Java program and another program on the network. Additionally, java.net includes the ServerSocket class, which implements a socket that servers can use to listen for and accept connections to clients. Data is read from and to sockets using the DataInputStream and DataOutputStream.

Aalborg Media Lab 15-Jul-15 Client Example Socket MyClient; MyClient = new Socket(“IP”, PortNumber); DataInputStream input; input = new DataInputStream(MyClient.getInputStream()); int res = input.readInt();

Aalborg Media Lab 15-Jul-15 References The Java Tutorial: Custom Networking ml#overview ml#overview JavaWorld: Writing client/server applications in Java sockets_p.html sockets_p.html

Aalborg Media Lab 15-Jul-15 EyesWeb and networking EyesWeb is function as a client able to send data to a TCP-Server –Server must be running before client executes application Use the Network.Output.SendToNetwork-Block to send data. Configure Block with proper server address (IP, port)

Aalborg Media Lab 15-Jul-15 EyesWeb Example

Aalborg Media Lab 15-Jul-15 Retrieving data from EyesWeb Don’t develop a TCP-Server from Scratch! –Reuse, extend existing solutions The eyeswebsocket class by Rune Andersen –Intergers –Interger-Arrays

Aalborg Media Lab 15-Jul-15 Creating a eyeswebsocket Create an eyeswebsocket object & run it; myeywtst myeywtst = new myeywtst(); eywsoc = new eyeswebsocket(7777); eywsoc.Verbose = true; eywsoc.blocking= false; eywsoc.waitconn(); // waiting for input

Aalborg Media Lab 15-Jul-15 Read data from eyeswebsocket Reading integers int num = eywsoc.scalarVal; Reading integer arrays int[][] array = eywsoc.matrixData; eywsoc.matrixCols //no. cols in array eywsoc.matrixRows //no. rows in array

Aalborg Media Lab 15-Jul-15 Reading data multiple times If new data is send from EyesWeb: eywsoc.scalarVal, eywsoc.matrixData is overwritten! –Readout data every x ms by using the Timer class (if you cant remember look at reboundPanel in your book) How often data is send from EyesWeb determines how often it must be read in JAVA. –delay due network transmission and computation time

Aalborg Media Lab 15-Jul-15 Exercises Programming Projects –Write a program that reads out the integer array from generated in EyesWeb –Displays it in Console or JTable