5 Network Programming

Advanced Java Programming · Unit 5 · 5 hrs

Network Programming

Exam-focused notes for Network Programming (Advanced Java Programming, CSC419): what the TU syllabus asks and how it has actually been tested, with 3 solved past questions from this unit.

What this unit covers

  • Transmission control Protocol (TCP), User Datagram Protocol (UDP), Ports, IP Address Network Classes in JDK
  • Socket programming using TCP, Socket programming using UDP, Working with URL's, Working with URL Connection Class
  • Java Mail API, Sending and Receiving Email

Socket programming using TCP, Socket programming using UDP, Working with URL's, Working with URL Connection Class

208110 marks

What is the task of the Listener interface? Write a socket program for a file server that makes a collection of files available for transmission to clients. When a client connects to the server, the server first reads a one-line command from the client. The command string can be of the form 'GET ', where is a file name. The server checks whether the requested file actually exists. If so, it first sends the word 'OK' as a message to the client. Then it sends the contents of the file and closes the connection. Otherwise, it sends 'ERROR' to the client as message and closes the connection. Assume that there is no sub directories.[10]

The Listener interface (specifically ServerSocket in Java TCP socket programming) is responsible for listening for incoming client connection requests on a specified port number. - It waits and listens on a specific port for any client attempting to make a ...

Full solved answer →
20765 marks

Write Java programs using TCP sockets that communicate with each other in a computer network. [5]

A socket is one endpoint of a two-way communication link between two programs running on the network. It is bound to a port number so that the TCP layer can identify the application data to be sent to the destination. The java.net package provides support f...

Full solved answer →

Java Mail API, Sending and Receiving Email

20785 marks

What is Java Mail API? How can you use this API to send email messages? [5]

The JavaMail API is an API used to compose, write, and read electronic messages (emails). It provides a protocol-independent and platform-independent framework for sending and receiving emails. The core classes of JavaMail API are found in the java.mail and...

Full solved answer →