서버

~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();
	}
}
Retrieved from http://wiki.zeropage.org/wiki.php/Server&Client/영동
last modified 2021-02-07 05:28:01