CS 4504 Lecture Notes - Lecture 9: Data Stream, Transport Layer Security, Network Socket

28 views2 pages
28 Sep 2016
School
Course
1
Chapter 4
The Socket API continued
Instructor Dr. P. Bobbie
Lecture Notes #8
Chapter 4
Event synchronization
In connection-orientated and connectionless the send operations are nonblocking while
the receive operations are blocking.
To avoid indefinite blocking receiving process may use the setSoTimeout method to set a
timeout. For example, 50 seconds. After that Java will throw Interrupt exception.
Connection-oriented datagram socket API
It is uncommon to employ datagram sockets for connection-oriented communication
The connection provided by this API is rudimentary and typically insufficient for application that
require a true connection.
Stream-mode sockets are typically more appropriate for connection-oriented communication.
Method call for connection-oriented datagram socket
Method/Constructor Description
Public void
Connect (InetAddress address, int port)
Creates a logical connection between this
socket and a socket at the remote address
and port.
Public void disconnect() Cancels the current connection, if any, from
this socket.
A connection is made for a socket with a remote socket. Once a socket is connected. It can only
exchange data with the remote socket.
The connection is unilateral (enforced by one side only).
The Stream-mode Socket API
The datagram socket API supports the exchange of discrete units of data.
The Stream Socket API provides a model of data transfer based on the stream- mode I/O.
A stream-mode socket is established for data exchange between two specific processes.
Data stream is written to the socket at one end, and read from the other end.
A stream socket cannot be used to communicate with more than one process.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.