Solved

How to write TFTP UDP client application program

Posted on 2004-04-04
3
1,733 Views
Last Modified: 2012-06-22
Hi
Could anybody tell me how to write simple TFTP client program using UDP socket programming.Whose function is to issue "Read" request to  the Server  to retrive file.
Thank you
 
0
Comment
Question by:Rafi-muqaddar
3 Comments
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 10751400
first thing to do in such case:
http://www.google.com/search?q=TFTP+UDP+client+java

i found one that looks good (the comments are in French):
http://monge.univ-mlv.fr/~roussel/vuibert/chapUDP/fr/umlv/ji/udp/
0
 
LVL 13

Accepted Solution

by:
Webstorm earned 500 total points
ID: 10751432
0
 

Author Comment

by:Rafi-muqaddar
ID: 10752358
Hi
thanx all of you for replying. Have a look on the following code:-
it is a simple UDP Echo client whose function is to echo back thorugh the server whatever typ by the user

import java.io.*;
import java.net.*;
public class UDPEchoClient
{
public static void main (String args[])
{
try
{
InetAddress host =InetAddress.getByName("localhost");
BufferedReader kbd = new BufferedReader(new InputStreamReader(System.in));
byte [] buf =new byte[1024];
DatagramSocket ds = new DatagramSocket();
DatagramPacket dp;
String line;
while((line=kbd.readLine())!=null)
{
dp =new DatagramPacket (line.getBytes(),line.length(), host,7);
ds.send(dp);
ds.receive(dp);
System.out.println(new String(dp.getData()));
}

}
catch(IOException e)
{
System.err.println(e);
}
}
}

My question is how to ammend this program inorder to work this program as a Tftp client to issue a "Read" rqeuest to the server to get the file.
Thanx
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now