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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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("lo calhost");
BufferedReader kbd = new BufferedReader(new InputStreamReader(System.i n));
byte [] buf =new byte[1024];
DatagramSocket ds = new DatagramSocket();
DatagramPacket dp;
String line;
while((line=kbd.readLine() )!=null)
{
dp =new DatagramPacket (line.getBytes(),line.leng th(), 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
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("lo
BufferedReader kbd = new BufferedReader(new InputStreamReader(System.i
byte [] buf =new byte[1024];
DatagramSocket ds = new DatagramSocket();
DatagramPacket dp;
String line;
while((line=kbd.readLine()
{
dp =new DatagramPacket (line.getBytes(),line.leng
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
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/