Network programming
TCP/IP: Application layer, Transport layer, network layer, powerlessness + data link layer
IP protocol is the main protocol of Network layer, which supports the inter-network datagram communication, it provides main functions: no-connection datagram transmission, datagram Routing and error control
TCP is a protocol specifically designed to provide reliable, end-to-end byte stream traffic on unreliable internet. It is a link-oriented protocol. TCP links are byte streams rather than message flows
UDP provides a way for an application to send an encapsulated raw IP datagram, and does not need to establish a link when it is sent. is an unreliable connection.
Socket
Two Java applications enable data exchange through a two-way network communication connection, one end of the bidirectional link becoming a socket
Sockets are typically used to implement client-server connections
The two class sockets and ServerSocket defined in the java.net package are used to implement a two-way connection between client and server side (TCP)
The IP address and port number of the remote computer that is required to establish the connection
Udp
Unreliable, high-efficiency
Gui
AWT includes many classes and interfaces for GUI programming of Java application
Container component is the two core class in AWT
Container is a component subclass, container subclasses can accommodate other component objects, and container objects can use the method AD (...). Add another Component object to it
Two commonly used container:window--whose objects represent a free-standing top-level window; Panel: Its object can be used as a host for other component objects, but cannot exist independently and must be added to other container
Methods of container
SetBounds (int x, int y, int width, int height)
setSize (int width, int height)
setlocation (int x, int y)
SetBackground (Color c)
SetVisible (Boolean B) setting is visible
Settitle (String name)
Setresizable (Boolean B) setting whether a positive size can be adjusted
Component Add (Component Comp) adds additional components to the container and returns the added component
Component getcomponentat (int x, int y) returns the component of the specified point
int Getcomponentcount () returns the number of components within the container
Component[] Getcomponents () returns all components within the container
There are two ways of new frame, one is direct Frame x = new Frame (..) Another is to make a subclass myframe inheritance, as far as possible with subclasses, because you can define your own member variables
The panel represents a container that cannot exist independently and must be placed in another container, and the panel is represented as a rectangular area that can contain other components in the area.
Can be used as a container to hold other components, providing space for placing components
Cannot exist alone and must be placed in other containers
FlowLayout layout Manager,
FlowLayout (int align, int hgap, int wgap)
Panel\applet uses FlowLayout as the layout manager by default
BorderLayout Layout Manager
BorderLayout
Java Note Horse soldier