본문 바로가기
프로젝트

놀이동산 프로젝트 - 기능 및 개념 공부

by 정구지개발자 2025. 3. 11.
728x90

<Socket>

 

 

Socket(String host, int port)

Creates a stream socket and connects it to the specified port number on the named host.
 

getInputStream
()
Returns an input stream for this socket.

 

getOutputStream()

Returns an output stream for this socket.

 

 

<serverSocket>

 

This class implements server sockets. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester.

 

ServerSocket(int port)

Creates a server socket, bound to the specified port.
 

 

public Socket accept()
              throws IOException
Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made.

A new Socket s is created and, if there is a security manager, the security manager's checkAccept method is called with s.getInetAddress().getHostAddress() and s.getPort() as its arguments to ensure the operation is allowed. This could result in a SecurityException.

Returns:the new Socket

 

ex) serverSocket = new ServerSocket(9999);

Socket socket  = serverSocket.accept();

 

 

728x90

'프로젝트' 카테고리의 다른 글

이미지 상대경로  (0) 2025.03.14
JFrame  (0) 2025.03.12
query 문 및 이미지 url  (0) 2025.03.12
놀이동산 프로젝트 - 기능 및 개념 공부  (1) 2025.03.11
github issues참고사이트  (0) 2025.03.11

댓글