Search This Blog

Showing posts with label UDP. Show all posts
Showing posts with label UDP. Show all posts

Java Program to Send Image between Computers using UDP and Display it

java program java code java application to send image files (photos or pictures) between computer using UDP across Network
Java program to send image file over network using UDP
This was one of my experiments in Networking Lab. The aim was to write a java program to send a
picture (image) from a computer to another via network using UDP protocol and to display it at the receiving end. Simply, this is the java code to make a java application which can send images from one computer to another over a network. The program uses UDP (User Datagram Protocol). For both the computers (on either ends) the same code is enough. This app can act as a image sender or a receiver. The program uses a Progress bar (JProgressBar) to show the progress of the data transfer. Remember, transferring files over UDP is not easy because UDP does not guarantee ordered delivery, and not even successful delivery. So, here in this program, to ensure ordered delivery, the sender sends next chunk of data (DatagramPacket) only after receiving an acknowledgement for last sent packet. For acknowledgement, i used a string "ACK".

Chat Room Application using UDP in Java

UDP chatroom application in java source code Chatting using java UDP java chat application java group chat application
Java Chat room application using UDP
The following is a Java program for chatting. This chatting application uses UDP (User Datagram
Protocol) for chatting. The application gives you to options. One is to create a new chat room and the other is to join a chat room. The one who creates the chat room acts as a server for the chatroom. Others can join this chatroom id they know his IP address. This simple java chat room application is enough for server and clients. The GUI is basic one and not too attractive. Also i have used JOptionPane to reduce code. You may make improvements to the code. The chat rooms are not password protected. Anyone who know the server's IP address are granted access to the chat room. If you wish, you may improve the program. This Group chat application using java can be used in Local area networks. This code for java group chat program can be modified to enable chatting in multiple chat rooms. Try it.