Link to home
Start Free TrialLog in
Avatar of Rafi-muqaddar
Rafi-muqaddar

asked on

How to write TFTP UDP client application program

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
 
Avatar of GrandSchtroumpf
GrandSchtroumpf

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/
ASKER CERTIFIED SOLUTION
Avatar of Webstorm
Webstorm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rafi-muqaddar

ASKER

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