Udt Massage Sender Receiver
+Client
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.net.ConnectException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
//import java.net.Socket;
import java.net.UnknownHostException;
public class sender{
private static int remotePort;
private static InetAddress remoteIpAddress;
static String sendmsg;
private static DatagramSocket senderSocket ;
private static ObjectOutputStream outToReceiver;
private static BufferedReader inFromUser;
private static DatagramPacket sendpacket;
public static void main(String[] argv) throws UnknownHostException, IOException{
/*
if ( argv.length != 2 ) {
printHelp();
return;
}
*/
String word = null;
BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
remotePort = 1006;
try {
//192.168.0.4
remoteIpAddress = InetAddress.getLocalHost();
} catch(NumberFormatException ex){
// 적당한 예외 처리
System.err.println(remoteIpAddress + ": invalid Port #");
printHelp();
return;
}catch (UnknownHostException e) {
e.printStackTrace();
}
System.out.println(remoteIpAddress);
try {
senderSocket = new DatagramSocket();
// 소켓 연결
} catch (ConnectException e) {
// 예외 처리 -- receiver 준비 안된 경우
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Client side Sender ready");
/*try {
sendmsg=inFromUser.readLine();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}*/
// stream 준비
//System.out.println(sendbyte);
String buf = null;
while(true){
try {
sendmsg=inFromUser.readLine();
byte[] sendbyte=sendmsg.getBytes();
DatagramPacket sendpacket = new DatagramPacket(sendbyte , sendbyte.length , remoteIpAddress ,...