Interface. Socket API. • Socket API. – Network programming interface. Socket. API
. TCP. UDP. IP ... Windows Winsock, BSD, OS X, Linux, Solaris, … – Socket ...
In Unix jargon, a socket is a file descriptor – an integer ... Types of Sockets:
Internet Sockets, unix sockets, .... Unix Network Programming, volumes 1-2 by W.
The reason for this option is that some higher-level Internet .... This socket options causes the destination IP address
Netbeans (opensource). □ Eclipse (opensource). □ BlueJ (designed for
introductory teaching, opensource). □ IntelliJ (payware, but those who use it say
it is ...
Staffa, modello basso. Dutch. Spanner. Portuguese. Dispositivo de aperto, construção plana. Polish. Åapa mocujÄ ca. S
Keywords: sockets, client-server, network programming-socket functions, OSI ...
In Linux, sockets and file descriptors also share the same file descriptor table.
Socket Programming. Kameswari ... In Unix jargon, a socket is a file descriptor –
an ..... Unix Network Programming, volumes 1-2 by W. Richard Stevens.
Jim Kurose, Keith Ross. Addison- ... J.F Kurose and K.W. Ross, All Rights
Reserved. 192.168.23.100:143 web server ... E.g. All port 80 request go the web
server.
The list of options that can be set and get by the socket options are listed in the fig ...... address by looking up the
The stages of extraction socket healing also will be discussed. ... Amler and
colleagues found that after extraction a blood clot filled the socket. After 7 days,
the ...
Alcune opzioni sono binarie (on o off). ▫ Altre hanno un valore (int o anche
strutture più complesse). 2. Livello delle Opzioni. ◇ Le opzioni sono divise in vari
...
Ying Cai. Lecture 2. CS587x. Socket Programming (C/Java). CS587x Lecture 3.
Department of Computer Science. Iowa State University. Internet Socket. Socket ...
285-11). 1 Claim. My invention relates to ball and socket joints, particularly those
used for making connection between the exhaust ports of combustion engines.
Jim Kurose, Keith Ross. Addison- ... J.F Kurose and K.W. Ross, All Rights
Reserved. 192.168.23.100:143 web server ... E.g. All port 80 request go the web
server.
Please refer to Richard Stevens book : “Unix. Network Programming” Volume 1
for details about any of the functions covered here, and also use the online man ...
mean 'buccal (esp. crestal) bone permanently losing periodontal ligament blood supply' leading to resorption of bundle bone & resultant loss of contour.
may reduce the depth of the socket in the AP direction from approximately 5.0 to 2.4 mm. These anatomic observations provide some evi- dence that the socket ...
With TCP, the available room in the socket receive buffer is the window that TCP avertises ..... One solution is for the
The core package java.net contains a number of classes that allow programmers
to carry out network programming. – ContentHandler. – DatagramPacket.
Summary. A finite element model to determine the socket stresses and resin pressures in a typical resin socket termination for a wire rope has been developed.
10 733 100 110. 0.130 0.130. 66 ... 10 733 150 110. 0.088 0.088 ..... Connecting
dimension: ANSI/ASME B 16.5 class 150, ASTM D 4024, BS 1560, BS. EN 1759.
Broadcasting is supported for only datagram sockets and only on net works ... Calling setsockopt leads to one of the fol
2. Outline. • APIs – Motivation. • Sockets. • Java Socket classes. • Tips for
programming. What is an API? • API – stands for Application Programming.
Interface ...
Announcement • Lectures moved to • 150 GSPP, public policy building, right opposite Cory Hall on Hearst. • Effective Jan 31 i.e. next Tuesday
Socket Programming Nikhil Shetty GSI, EECS122 Spring 2006
1
Outline • • • •
APIs – Motivation Sockets Java Socket classes Tips for programming
What is an API? • API – stands for Application Programming Interface
2
What is an API? • API – stands for Application Programming Interface. • Interface to what? – In our case, it is an interface to use the network.
What is an API? • API – stands for Application Programming Interface. • Interface to what? – In our case, it is an interface to use the network. • A connection to the transport layer.
3
What is an API? • API – stands for Application Programming Interface. • Interface to what? – In our case, it is an interface to use the network. • A connection to the transport layer.
• WHY DO WE NEED IT?
Need for API • One Word - Layering • Functions at transport layer and below very complex. • E.g. Imagine having to worry about errors on the wireless link and signals to be sent on the radio.
4
APPLICATION API TRANSPORT NETWORK LINK PHYSICAL
Layering Diagramatically Application API System Calls LAN Card
Radio
5
What is a socket then? • What is a socket?
Introduction • What is a socket? • It is an abstraction that is provided to an application programmer to send or receive data to another process.
6
Introduction • What is a socket? • It is an abstraction that is provided to an application programmer to send or receive data to another process. • Data can be sent to or received from another process running on the same machine or a different machine.
Socket – An Abstraction
Adapted from http://www.troubleshooters.com/codecorn/sockets/
7
Sockets • • • •
It is like an endpoint of a connection Exists on either side of connection Identified by IP Address and Port number E.g. Berkeley Sockets in C • Released in 1983 • Similar implementations in other languages
Engineers working on Sockets!!!
http://www.fotosearch.com/MDG238/frd1404/
8
Client – Server Architecture
From http://publib.boulder.ibm.com/infocenter/txen/topic/com.ibm.txseries510.doc/atshak0011.htm
Java Sockets • Part of the java.net package • import java.net.*;
• Provides two classes of sockets for TCP • Socket – client side of socket • ServerSocket – server side of socket
• Provides one socket type for UDP • DatagramSocket
Java TCP Sockets • ServerSocket performs functions bind and listen • Bind – fix to a certain port number • Listen – wait for incoming requests on the port
• Socket performs function connect • Connect – begin TCP session
10
TCP sockets • TCP as a byte-stream • During data packet. transmission, no packetization and addressing required by application. • Formatting has to be provided by application. • Two or more successive data sends on the pipe connected to socket may be combined together by TCP in a single packet. • E.g. Send “Hi” then send “Hello Nikhil” is combined by TCP to send as “HiHello Nikhil”
UDP sockets • UDP is packet-oriented • • • •
Info sent in packet format as needed by app. Every packet requires address information. Lightweight, no connection required. Overhead of adding destination address with each packet.
11
Java Quiz Q. A constructor is used to... A. Free memory. B. Initialize a newly created object. C. Import packages. D. Create a JVM for applets.
Java Quiz Q. A constructor is used to... A. Free memory. B. Initialize a newly created object. C. Import packages. D. Create a JVM for applets.
12
Socket Class • Socket • Socket nameSocket = null; • nameSocket = new Socket(“hostname", portno);
• ServerSocket • ServerSocket nameSocket = new ServerSocket(portno); • Causes it to listen until there is a connection.
Accept • Socket connectionSocket = nameSocket.accept(); • Creates a new socket to connect to the client. • Waits till a new connection request appears.
Read or write from socket • Associated with classes DataOutputStream and BufferedReader which create input and output streams. • nameSocket.getInputStream() and nameSocket.getOutputStream() return input and output streams respectively. • These streams assigned to local stream classes and byte stream can be input or output.
14
DatagramSocket Class • DatagramSocket nameSocket = new DatagramSocket(); • DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, portno); • DatagramPacket recvPacket = new DatagramPacket(recvData, recvData.length); • nameSocket.send(sendPacket); • nameSocket.receive(recvPacket)
Programming Tips • Good programming techniques • Enclose all socket creations in try{…} and use catch() {…} to get the error conditions •
• Use tcpdump/Ethereal to see what is being transmitted on the link. • Check online guides to Java and Network Programming.
15
Network Programming Tips (contd) • How to check if particular port is listening • Windows – use netstat • netstat -an
• Linux – use nmap • nmap -sT -O localhost
• Tip: Use port numbers greater than 1024. • Tip: InetAddress IPAddress = InetAddress.getByName(“hostname”); • Check RFCs if in doubt about protocols. • http://www.ietf.org/rfc
• Lots of System.out.println(“present_condition”); •