This document discusses Java networking and client/server communication. A client machine makes requests to a server machine over a network using protocols like TCP and UDP. TCP provides reliable data transmission while UDP sends independent data packets. Port numbers map incoming data to running processes. Sockets provide an interface for programming networks, with ServerSocket and Socket classes in Java. A server program listens on a port for client connections and exchanges data through input/output streams. Servlets extend web server functionality by executing Java programs in response to client requests.
The presentation given at MSBTE sponsored content updating program on 'Advanced Java Programming' for Diploma Engineering teachers of Maharashtra. Venue: Guru Gobind Singh Polytechnic, Nashik
Date: 22/12/2010
Session: Java Network Programming
The presentation given at MSBTE sponsored content updating program on 'Advanced Java Programming' for Diploma Engineering teachers of Maharashtra. Venue: Guru Gobind Singh Polytechnic, Nashik
Date: 22/12/2010
Session: Java Network Programming
This is all about socket programming in java using TCP and UDP socket and an example of simple Echo Server.
Also includes concepts of the socket, Socket class and methods and use of those.
Network programming in java - PPT with Easy Programs and examples of Java InetAddress Class and java socket programming example.
Learn more @ http://java2all.com/technology/network-programming
Java Network Programming getting started, Getting Started with java network programming, two tier architecture, java client server programming, core java, java to standard edition, core java, Introduction to network programming in java
This is all about socket programming in java using TCP and UDP socket and an example of simple Echo Server.
Also includes concepts of the socket, Socket class and methods and use of those.
Network programming in java - PPT with Easy Programs and examples of Java InetAddress Class and java socket programming example.
Learn more @ http://java2all.com/technology/network-programming
Java Network Programming getting started, Getting Started with java network programming, two tier architecture, java client server programming, core java, java to standard edition, core java, Introduction to network programming in java
The Presentation given at Guru Gobind Singh Polytechnic, Nashik for Third Year Information Technology and Computer Engineering Students on 08/02/2011.
Topic: Java Network Programming
Client Server is networking based project.We made presentation slides to present this topic.It is helpful to everyone.Here we talked about socket programming too.
Project Assignment 2 Building a Multi-Threaded Web ServerThis pro.docxkacie8xcheco
Project Assignment 2: Building a Multi-Threaded Web Server
This project assignment is due at the end of the seventh week of the course and is worth 7% of your total grade.
In this project, we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous service requests in parallel. Section 2.7 of your text may offer you some insight and help. You should be able to demonstrate that your Web server is capable of delivering your home page to a Web browser.
We are going to implement Version 1.0 of HTTP, as defined in
RFC 1945
, where separate HTTP requests are sent for each component of the Web page. The server will be able to handle multiple simultaneous service requests in parallel. This means that the Web server is multi-threaded. In the main thread, the server listens to a fixed port. When it receives a TCP connection request, it sets up a TCP connection through another port and services the request in a separate thread. To simplify this programming task, we will develop the code in two stages. In the first stage, you will write a multi-threaded server that simply displays the contents of the HTTP request message that it receives. After this program is running properly, you will add the code required to generate an appropriate response.
As you are developing the code, you can test your server from a Web browser. Just remember that you are not serving through the standard port 80, so you need to specify the port number within the URL that you give to your browser. For example, if your machine's name is
host.someschool.edu
, your server is listening to port 6789, and you want to retrieve the file
index.html
, then you would specify the following URL within the browser:
http://host.someschool.edu:6789/index.html
If you omit ":6789," the browser will assume port 80, which most likely will not have a server listening on it.
When the server encounters an error, it sends a response message with the appropriate HTML source so that the error information is displayed in the browser window.
Web Server in Java: Part A
In the following steps, we will go through the code for the first implementation of our Web server. Wherever you see "?," you will need to supply a missing detail.
Our first implementation of the Web server will be multi-threaded, where the processing of each incoming request will take place inside a separate thread of execution. This allows the server to service multiple clients in parallel, or to perform multiple file transfers to a single client in parallel. When we create a new thread of execution, we need to pass to the Thread's constructor an instance of some class that implements the
Runnable
interface. This is the reason why we define a separate class called
HttpRequest
. The structure of the Web server is shown below:
import java.io.* ;
import java.net.* ;
import java.util.* ;
public final class WebServer
{
public static void main(S.
How a network connection is created A network connection is initi.pdfarccreation001
How a network connection is created ?
A network connection is initiated by a client program when it creates a socket for the
communication with the server. To create the socket in Java, the client calls the Socket
constructor and passes the server address and the the specific server port number to it. At this
stage the server must be started on the machine having the specified address and listening for
connections on its specific port number.
The server uses a specific port dedicated only to listening for connection requests from clients. It
can not use this specific port for data communication with the clients because the server must be
able to accept the client connection at any instant. So, its specific port is dedicated only to
listening for new connection requests. The server side socket associated with specific port is
called server socket. When a connection request arrives on this socket from the client side, the
client and the server establish a connection. This connection is established as follows:
The java.net package in the Java development environment provides the class Socket that
implements the client side and the class serverSocket class that implements the server side
sockets.
The client and the server must agree on a protocol. They must agree on the language of the
information transferred back and forth through the socket. There are two communication
protocols :
The stream communication protocol is known as TCP (transfer control protocol). TCP is a
connection-oriented protocol. It works as described in this document. In order to communicate
over the TCP protocol, a connection must first be established between two sockets. While one of
the sockets listens for a connection request (server), the other asks for a connection (client). Once
the two sockets are connected, they can be used to transmit and/or to receive data. When we say
\"two sockets are connected\" we mean the fact that the server accepted a connection. As it was
explained above the server creates a new local socket for the new connection. The process of the
new local socket creation, however, is transparent for the client.
The datagram communication protocol, known as UDP (user datagram protocol), is a
connectionless protocol. No connection is established before sending the data. The data are sent
in a packet called datagram. The datagram is sent like a request for establishing a connection.
However, the datagram contains not only the addresses, it contains the user data also. Once it
arrives to the destination the user data are read by the remote application and no connection is
established. This protocol requires that each time a datagram is sent, the local socket and the
remote socket addresses must also be sent in the datagram. These addresses are sent in each
datagram.
The java.net package in the Java development environment provides the class DatagramSocket
for programming datagram communications.
UDP is an unreliable protocol. There is no guarantee that the .
[Type text]ECET465Project 2Project Assignment 2 Building a Mul.docxhanneloremccaffery
[Type text] ECET465
Project 2Project Assignment 2: Building a Multi-Threaded Web Server
This project assignment is due at the end of the seventh week of the course and is worth 7% of your total grade.
In this project, we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous service requests in parallel. Section 2.7 of your text may offer you some insight and help. You should be able to demonstrate that your Web server is capable of delivering your home page to a Web browser.
We are going to implement Version 1.0 of HTTP, as defined in RFC 1945, where separate HTTP requests are sent for each component of the Web page. The server will be able to handle multiple simultaneous service requests in parallel. This means that the Web server is multi-threaded. In the main thread, the server listens to a fixed port. When it receives a TCP connection request, it sets up a TCP connection through another port and services the request in a separate thread. To simplify this programming task, we will develop the code in two stages. In the first stage, you will write a multi-threaded server that simply displays the contents of the HTTP request message that it receives. After this program is running properly, you will add the code required to generate an appropriate response.
As you are developing the code, you can test your server from a Web browser. Just remember that you are not serving through the standard port 80, so you need to specify the port number within the URL that you give to your browser. For example, if your machine's name is host.someschool.edu, your server is listening to port 6789, and you want to retrieve the file index.html, then you would specify the following URL within the browser: http://host.someschool.edu:6789/index.html
If you omit ":6789," the browser will assume port 80, which most likely will not have a server listening on it.
When the server encounters an error, it sends a response message with the appropriate HTML source so that the error information is displayed in the browser window.
Web Server in Java: Part A
In the following steps, we will go through the code for the first implementation of our Web server. Wherever you see "?," you will need to supply a missing detail.
Our first implementation of the Web server will be multi-threaded, where the processing of each incoming request will take place inside a separate thread of execution. This allows the server to service multiple clients in parallel, or to perform multiple file transfers to a single client in parallel. When we create a new thread of execution, we need to pass to the Thread's constructor an instance of some class that implements the Runnable interface. This is the reason why we define a separate class called HttpRequest. The structure of the Web server is shown below: import java.io.* ;import java.net.* ;import java.util.* ;public final class WebServer{ public.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
2. CLIENT/SERVER
COMMUNICATION
At a basic level, network-based systems consist of
a server , client , and a media for communication
A computer running a program that makes a
request for services is called client machine.
A computer running a program that offers
requested services from one or more clients is
called server machine.
The media for communication can be wired or
wireless network.
3. Generally, programs running on client machines
make requests to a program running on a server
machine. They involve networking services
provided by the transport layer, which is part of
the Internet software stack, often called TCP/IP
(Transport Control Protocol/Internet Protocol)
The transport layer comprises two types of
protocols,
TCP
(Transport Control Protocol)
UDP (User Datagram Protocol).
The most widely used programming
interfaces for these protocols are
“sockets”.
4. TCP is a connection-oriented protocol that
provides a reliable flow of data between two
computers. Example applications that use such
services are HTTP, FTP, and Telnet.
UDP is a protocol that sends independent packets
of data, called “datagrams”, from one computer to
another with no guarantees about arrival and
sequencing. Example applications that use such
services include Clock server and Ping.
The TCP and UDP protocols use “ports” to map
incoming data to a particular process running on a
computer.
Port is represented by a positive (16-bit) integer
value
5. Some ports have been reserved to support
common/well known services like ftp, http, https
etc.
User-level process/services generally use port
number value >= 1024.
Every computer on the Internet is identified by a
unique, 4-byte IP address .
This is typically written in dotted quad format
like 128.250.25.158 where each byte is an
unsigned value between 0 and 255.
This representation is not user-friendly because it
does not tell us anything about the content and
then it is difficult to remember. Hence, IP
addresses are mapped to names like
www.google.com, which are easier to remember.
Domain name servers(DNS) translate these
names to IP addresses.
6. Computers often need to communicate and
provide more than one type of service or to talk to
multiple hosts/computers at a time. For example,
there may be multiple ftp sessions, web
connections, and chat programs all running at the
same time.
To distinguish these services, a concept of “port” s,
a logical access point, represented by a 16-bit
integer number is used.
That means, each service offered by a computer is
uniquely identified by a port number.
Each Internet packet contains both the
destination host address and the port number on
that host to which the message/request has to be
delivered.
The host computer dispatches the packets it
receives to programs by looking at the port
numbers specified within the packets.
7. SOCKET
Sockets provide an interface for programming
networks at the transport layer.
A server runs on a specific computer and has a
socket that is bound to a specific port.
The server listens to the socket for a client to
make a connection request
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
(consequently a different port number) so that it
can continue to listen to the original socket for
connection requests while serving the connected
client.
8.
9. Socket is bound to a port number so that the TCP
layer can identify the application that data is
destined to be sent.
Java provides a set of classes, defined in a
package called java.net, to enable the rapid
development of network applications.
The two key classes from the java.net package
used in creation of server and client programs
are:
ServerSocket
Socket
10. SOCKET PROGRAMMING USING TCP
A server program creates a specific type of socket
that is used to listen for client requests (server
socket), In the case of a connection request, the
program creates a new socket through which it
will exchange data with the client using input
and output streams.
11. STEPS TO CREATE SERVER
PROGRAM
1. Open the Server Socket:
ServerSocket server = new ServerSocket( PORT );
2. Wait for the Client Request:
Socket client = server.accept();
3. Create I/O streams for communicating to the client
DataInputStream is = new
DataInputStream(client.getInputStream());
DataOutputStream os = new
DataOutputStream(client.getOutputStream());
4. Perform communication with client
Receive from client: String line = is.readLine();
Send to client: os.writeBytes(“Hellon”);
5. Close socket:
client.close();
12. STEPS TO CREATE CLIENT
PROGRAM
1. Create a Socket Object:
Socket client = new Socket(server, port_id);
2. Create I/O streams for communicating with the
server.
is = new DataInputStream(client.getInputStream());
os = new
DataOutputStream(client.getOutputStream());
3. Perform I/O or communication with the server:
Receive data from the server:
String line = is.readLine();
Send data to the server: os.writeBytes(“Hellon”);
4. Close the socket when done:
client.close();
13. Sending E-Mail
To send e-mail, you make a socket connection to port 25, the
SMTP port. SMTP is the Simple Mail Transport Protocol that
describes the format for e-mail messages.
1. Open a socket to your host.
Socket s = new Socket("mail.yourserver.com", 25); // 25 is
PrintWriter out = new PrintWriter(s.getOutputStream());
2. Send the following information to the print stream:
HELO sending host
MAIL FROM: <sender email address>
RCPT TO: <recipient email address>
DATA
mail message
(any number of lines)
.
QUIT
14.
Most SMTP servers do not check the veracity of the
information—you may be able to supply any sender you
like.
15. Internet addresses
Usually, you don't have to worry too much about Internet
addresses—the numerical host addresses that consist of
four bytes such as 132.163.4.102. However, you can use the
InetAddress class if you need to convert between host
names and Internet addresses.
The static getByName method returns an InetAddress
object of a host.
For example,
InetAddress address= InetAddress.getByName(“india.gov");
returns an InetAddress object that encapsulates the
sequence of four bytes 132.163.4.102.
You can access the bytes with the getAddress method.
byte[] addressBytes = address.getAddress();
16. Some host names with a lot of traffic correspond to
multiple Internet addresses, to facilitate load balancing.
For example, at the time of this writing, the host name
google.com corresponds to different Internet addresses.
One of them is picked at random when the host is
accessed. You can get all hosts with the getAllByName
method.
InetAddress[] addresses =InetAddress.getAllByName(host);
Finally, you sometimes need the address of the local host.
If you simply ask for the address of localhost, you always
get the address 127.0.0.1, which isn't very useful. Instead,
use the static getLocalHost method to get the address of
your local host.
InetAddress address= InetAddress.getLocalHost();
17. URL Connections
The URL and URLConnection classes encapsulate much of the
complexity of retrieving information from a remote site.
URL url = new URL(urlString);
The Java 2 platform supports both HTTP and FTP resources.
If you simply want to fetch the contents of the resource, then you can
use the openStream method of the URL class. This method yields an
InputStream object. Using this stream object, you can easily read the
contents of the resource.
InputStream uin = url.openStream();
BufferedReader in =
new BufferedReader(new InputStreamReader(uin));
String line;
while ((line = in.readLine()) != null)
{
process line;
}
18. Posting Form Data
we saw how to read data from a web server. Now
we learn how your programs can send data back
to a web server and to programs that the web
server invokes, using the CGI (Common Gateway
Interface).
check boxes and radio buttons are sent back to
the server to be processed by a CGI script.
The CGI script to use is specified in the ACTION
attribute of the FORM tag.
The CGI script is a program that resides on the
server computer. The web server launches the
CGI script and feeds it the form data.
19. What Is a Servlet?
Servlets are small programs that execute on the server side of a web
connection.
Just as applets dynamically extend the functionality of a web
browser, servlets dynamically extend the functionality of a web
server.
In the early days of the Web, a server could dynamically construct a
page by creating a separate process to handle each client request.
It communicated with the web server via an interface Common
Gateway Interface (CGI). CGI allowed the separate process to read
data from the HTTP request and write data to the HTTP response.
CGI suffered serious performance problems.
It was expensive in terms of processor and memory resources to
create a separate process for each client request.
It was also expensive to open and close database connections for each
client request
The CGI programs were not platform-independent
20. Advantages of Servlets
Servlets offer several advantages in comparison with CGI.
Performance is significantly better.
Servlets execute within the address space of a web server.
It is not necessary to create a separate process to handle
each client request.
servlets are platform-independent because they are written
in Java.
the Java security manager on the server enforces a set of
restrictions to protect the resources on a server machine.
Finally, the full functionality of the Java class libraries is
available to a servlet. It can communicate with applets,
databases, or other software via the sockets that you have
seen already.
21. The Life Cycle of a Servlet
init( ), service( ), and destroy( ) methods
HTTP request for generated for a URL.
Web server maps this request to a particular servlet which
is dynamically retrieved and loaded.
The server invokes the init( ) method of the servlet.
The server invokes the service( ) method of the servlet;
may also formulate an HTTP response for the client.
The server may decide to unload the servlet from its
memory using destroy() method
22. To create servlets, you will need access to a servlet
development environment.
The one we will use is Tomcat. Tomcat is an opensource product maintained by the Jakarta Project of the
Apache Software Foundation. It contains the class
libraries, documentation, and runtime support that you
will need to create and test servlets.
23. Servlet API
javax.servlet Package
Interfaces Description
Servlet- Declares life cycle methods for a servlet.
ServletConfig- Allows servlets to get initialization parameters.
ServletContext- Enables servlets to log events and access information
about their environment.
ServletRequest- Used to read data from a client request.
ServletResponse- Used to write data to a client response.
SingleThreadModel- Indicates that the servlet is thread safe.
24. Servlet API Contd…
Classes
Description
GenericServlet- Implements the Servlet and ServletConfig
interfaces.
ServletInputStream- Provides an input stream for reading
requests from a client.
ServletOutputStream- Provides an output stream for
writing responses to a client.
ServletException- Indicates a servlet error occurred.
UnavailableException- Indicates a servlet is unavailable.
25. Servlet API Contd…
javax.servlet.http Package
Interface
Description
HttpServletRequest Enables servlets to read data from an
HTTP request.
HttpServletResponse Enables servlets to write data to an
HTTP response.
HttpSession Allows session data to be read and written.
26. Servlet API Contd…
Classes
Description
Cookie- Allows state information to be stored on a client
machine.
HttpServlet- Provides methods to handle HTTP requests
and
responses.
HttpSessionEvent- Encapsulates a session-changed event.