U E D R , A S I H C RSS

Server&Client/영동

  • 아직 문자열 전송은 못 했고 연결만 했습니다.

서버

~cpp 
import java.io.*;
import java.net.*;

public class SimpleServerSocketTest
{
	public static void main(String[] args) throws IOException
	{
		ServerSocket server=new ServerSocket(10000);
		System.out.println(server);
		System.out.println("접속을 기다립니다.");
		Socket accepted=server.accept();
		System.out.println(accepted);
		accepted.close();
		System.out.println("종료합니다.\n");
	}
}

클라이언트

~cpp 
import java.io.*;
import java.net.*;

public class SimpleSocketTest
{
	public static void main(String[] args) throws IOException
	{
		Socket connect=new Socket("165.194.17.85", 10000);//서버 컴퓨터의 IP였음
		System.out.println(connect);
		connect.close();
	}
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:01
Processing time 0.0173 sec