1234567891011121314151617181920212223242526272829303132333435 |
- import java.io.*;
- import java.net.*;
- public class ftpc
- {
- public static void main(String arg[]) throws IOException
- {
- try
- {
- DatagramSocket sock=new DatagramSocket();
- InetAddress ip=InetAddress.getByName("localhost");
- FileReader fr=new FileReader("input.txt");
- BufferedReader x=new BufferedReader(fr);
- String str1;
- while((str1=x.readLine())!=null)
- {
- byte[] send;
- byte[] recieve=new byte[1024];
- send=str1.getBytes();
- DatagramPacket sendpack=new DatagramPacket(send,send.length,ip,5060);
- sock.send(sendpack);
- // DatagramPacket recepack=new DatagramPacket(recieve,recieve.length);
- // sock.receive(recepack);
- // String str=new String(recepack.getData(),0,recepack.getLength());
- // System.out.println("read the content"+str);
- }
- x.close();
- }
- catch(Exception e)
- {
- System.out.println(""+e);
- }
- }
- }
|