import java.net.*;
import java.io.*;
class Client
{
public static DatagramSocket ds;
public static int clientport=790,serverport=789;
public static void main(String args[])throws IOException
{
byte buffer[]=new byte[1024];
ds=new DatagramSocket(clientport);
BufferedReader dis=new BufferedReader(new InputStreamReader(System.in));
System.out.println("\t\t******************\n\t\t**CLIENT PROGRAM**\n\t\t*********\nCLIENT WAITING FOR INPUT");
InetAddress ia=InetAddress.getByName("localhost");
while(true)
{
String str=dis.readLine();
if(str==null||str.equals("end"))
break;
buffer=str.getBytes();
ds.send(new DatagramPacket(buffer,str.length(),ia,serverport));
}
}
}
No comments:
Post a Comment