목차
① 소스코드
㉠ 서버
㉡ 클라이언트
② 실행화면
㉠ 서버
㉡ 클라이언트
② 실행화면
본문내용
ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
try
{
writer.writeUTF(sendBox.getText());
writer.flush();
String fileInfo = reader.readUTF();
msgView.setText(\"[filecli 127.0.0.1 1884] \" + sendBox.getText() + \"\\n\" + sendBox.getText() + \" file is uploding...\\n\");
msgView.append(fileInfo);
sendBox.setText(\"\");
}
catch(Exception ie)
{
}
}
});
pack();
}
private void connect()
{
try
{
socket = new Socket(\"127.0.0.1\", 7777);
msgView.append(\"connected... file name?\\n\");
reader = new DataInputStream(socket.getInputStream());
writer = new DataOutputStream(socket.getOutputStream());
}
catch(Exception e)
{
msgView.append(\"Not connected...\");
}
}
public static void main(String[] args)
{
Client client = new Client(\"파일 전송 프로그램\");
client.setVisible(true);
client.connect();
}
}
② 실행화면
{
public void actionPerformed(ActionEvent ae)
{
try
{
writer.writeUTF(sendBox.getText());
writer.flush();
String fileInfo = reader.readUTF();
msgView.setText(\"[filecli 127.0.0.1 1884] \" + sendBox.getText() + \"\\n\" + sendBox.getText() + \" file is uploding...\\n\");
msgView.append(fileInfo);
sendBox.setText(\"\");
}
catch(Exception ie)
{
}
}
});
pack();
}
private void connect()
{
try
{
socket = new Socket(\"127.0.0.1\", 7777);
msgView.append(\"connected... file name?\\n\");
reader = new DataInputStream(socket.getInputStream());
writer = new DataOutputStream(socket.getOutputStream());
}
catch(Exception e)
{
msgView.append(\"Not connected...\");
}
}
public static void main(String[] args)
{
Client client = new Client(\"파일 전송 프로그램\");
client.setVisible(true);
client.connect();
}
}
② 실행화면
소개글