Java             3GL - .   4GL -     DB-

JAVA

Java

java.net. Java TCP/IP, -, -, , , , - .

InetAddress

Java , Internet, InetAddress. Internet , , , 32- .

InetAddress . . , , . , InetAddress , . getLocalHost, getByName getAllByName.

, WWW- , .

InetAddress Address = InetAddress.getLocalHost();

System.out.println(Address);

Address = InetAddress.getByName("mailhost");

System.out.println(Address);

InetAddress SW[] = InetAddress.getAllByNarne(www.starwave.com");

System.out.println(SW);

InetAddress , , :

, UDP (User Datagram Protocol) , fire-and-forget ( ). , , UDP .

UDP . UDP - , , , . , , , .

Java UDP, . DatagramPacket , a DatagramSocket , DatagramPacket.

TCP/IP- , - Internet. - Java , , Internet. DatagramSocket, Socket .

java.net Socket ServerSocket . , ServerSocket , , , Socket -, , . Socket Internet. :

Socket Internet , . :

, Socket , , . , -, :

880 timehost .

import java.net.*;

import java.io.*;

class TimeHost {

public static void main(String args[]) throws Exception {

int c;

Socket s = new Socket("timehost.starwave.com",880);

InputStream in = s.getInputStream();

while ((c = in.read()) != -1) {

System.out.print( (char) c);

}

s.close();

} }

, Java . Internet ServerSocket. ServerSocket, , , . accept(), , - . , , accept() Socket.

ServerSocket , , ( ) , .

URL

URL (Uniform Resource Locators ) . URL Internet URL.

URL Java - . URL , , :

URL(String spec)

URL, :

URL(String protocol, String host, int port, String file)

URL(String protocol, String host, String file)

, URL , URL.

URL(URL context, String spec)

URL, www- ( ), .

import java.net.URL;

class myURL {

public static void main(String args[]) throws Exception {

URL hp = new URL("http://coop.chuvashia.edu");

System.out. println("Protocol: " + hp.getProtocol());

System.out.printin("Port: " + hp.getPort());

System.out.println("Host: " + hp.getHost());

System.out.println("File: " + hp.getFile());

System.out.println("Ext: " + hp.toExternaLForm());

} }

, , URL, URL URLConnection, openConnection().

URLConnection

URLConnection , , URL, . URLConnection openConnection, URL. .

import java.net.*;

import java.io.*;

class localURL {

public static void main(String args[]) throws Exception {

int c;

URL hp = new URL("http", "127.0.0.1", 80, "/");

URLConnection hpCon = hp.openConnection();

System.out.println("Date: " + hpCon.getDate());

System.out.println("Type: " + hpCon.getContentType());

System.out.println("Exp: " + hpCon.getExpiration());

System.out.println( "Last M: " + hpCon.getLastModified());

System.out.println("Length: " + hpCon.getContentLength());

if (hpCon.getContentLength() > 0) {

System.out.println("=== Content ===");

InputStream input = hpCon.getInputStream();

int i=hpCon.getContentLength();

while (((c = input. read()) != -1) && (--i > 0)) {

System.out.print((char) c);

}

input.close();

}

else {

System.out.println("No Content Available");

}

} }

HTTP- 80 ( Web-) , - index.html. , .

Java Internet. , java.net - , Java Internet.

Java             3GL - .   4GL -     DB-


, - - . .




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution