Работа в сети
What is a socket? How do you facilitate inter process communication in channel, which facilitates inter. Java? • A socket is a communication process communication (For example communicating between two JVMs, which may or may not be running on two different physical machines). A socket is an endpoint for communication. There are two kinds of sockets, depending on whether one wishes to use a connectionless or a connection-oriented protocol. The connectionless communication protocol of the Internet is called UDP. The connection-oriented communication protocol of the Internet is called TCP. UDP sockets are also called datagram sockets. Each socket is uniquely identified on the entire Internet with two numbers. The first number is a 128 -bit integer called the Internet Address (or IP address). The second number is a 16 -bit integer called the port of the socket. The IP address is the location of the machine, which you are trying to connect to and the port number is the port on which the server you are trying to connect is running. The port numbers 0 to 1023 are reserved for standard services such as e-mail, FTP, HTTP etc.
Sockets (2) • The lifetime of the socket is made of 3 phases: Open Socket –> Read and Write to Socket –> Close Socket • To make a socket connection you need to know two things: An IP address and port on which to listen/connect. In Java you can use the Socket (client side) and Server. Socket (Server side) classes.
How will you call a Web server from a stand alone Java application? • Using the java. net. URLConnection and its subclasses like Http. URLConnection and Jar. URLConnection.