0% found this document useful (0 votes)
3 views3 pages

Networking Java Notes

The document covers key concepts in multithreading, networking, and database connectivity in Java. It explains thread priority, synchronization, and life cycle, as well as UDP and TCP communication, JDBC, and HTTP requests. Additionally, it discusses the roles of firewalls and proxies in network communication.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Networking Java Notes

The document covers key concepts in multithreading, networking, and database connectivity in Java. It explains thread priority, synchronization, and life cycle, as well as UDP and TCP communication, JDBC, and HTTP requests. Additionally, it discusses the roles of firewalls and proxies in network communication.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Thread Priority

Thread priority defines importance of a thread (1-10). Higher priority executes first.
Thread t = new Thread();
[Link](Thread.MAX_PRIORITY);
High → First
Low → Later

2. Thread Synchronization

Controls access to shared resources, avoids race conditions.


synchronized void display(){
[Link]("Safe");
}
Thread1 & Thread2 → [Sync] → Safe

3. Thread

A thread is a lightweight process for multitasking.


class MyThread extends Thread{
public void run(){[Link]("Run");}
}
Process → Thread1, Thread2

4. UDP Server

UDP is connectionless communication.


DatagramSocket ds=new DatagramSocket(9876);
byte[] b=new byte[1024];
DatagramPacket dp=new DatagramPacket(b,[Link]);
[Link](dp);
Client → Packet → Server

5. Networking

Networking connects systems to share data.


InetAddress ip=[Link]("localhost");
[Link](ip);
PC1 → Router → PC2

6. Multithreading

Executes multiple threads simultaneously.


new Thread(()->[Link]("A")).start();
new Thread(()->[Link]("B")).start();
T1, T2, T3
7. TCP Client Socket

TCP provides reliable communication.


Socket s=new Socket("localhost",1234);
[Link]().write("Hi".getBytes());
Client === Server

8. JDBC

JDBC connects Java to database.


Connection con=[Link](url);
Statement st=[Link]();
Java → JDBC → DB

9. Thread Life Cycle

States: New, Runnable, Running, Waiting, Dead.


Thread t=new Thread();
[Link]();
New→Runnable→Running→Dead

10. JDBC Architecture

Uses drivers to connect app and DB.


[Link]("[Link]");
App→JDBC→Driver→DB

11. HTTP Communication


Client sends request, server responds.
URL url=new URL("[Link]
[Link]([Link]());
Client→Req→Server→Res→Client

12. IP Address

Identifies device in network.


InetAddress ip=[Link]();
[Link]([Link]());
[Link]

13. Firewall & Proxy

Firewall filters traffic; Proxy acts as intermediary.


[Link]("[Link]","[Link]");
Client→Proxy→Internet

You might also like