Solved

How to write TFTP UDP client application program

Posted on 2004-04-04
3
1,741 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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 third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

786 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