• Post Reply Bookmark Topic Watch Topic
  • New Topic

Datagram Communication  RSS feed

 
Alex Rugav
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you write the following program using datagram communication implementation:

public class client {
public static void main(String [] args) throws IOException{
Socket sock = new Socket (InetAddress.getLocalHost(),2000);
BufferedWriter dataout;
String Message = "Hello";
system.out.println("Sending" + Message+ "....");
dataout = new BufferedWriter(new OutputStreamWriter(sock.getOutputSream()));
dataout.write(Message,0,Message.length());
dataout.flush();
sock.close();
}
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!