Connect two client sockets

前端 未结 12 1502
执笔经年
执笔经年 2020-12-10 03:58

Let\'s say Java has two kind of sockets:

  • server sockets \"ServerSocket\"
  • client sockets or just \"Socket\"

Imagine the situation of two

12条回答
  •  猫巷女王i
    2020-12-10 04:24

    Why do we need a middle server? If you just want to expose VNCServer. Why not try an architecture like following

    VNCServer(S) <-> (C)MyApp(S) <-> (C) User
    
    (S) represents a server socket
    (C) represents a client socket
    

    In this case MyApp acts both as a client (for VNCServer) and as a server(for User). So you will have to implement both client and server sockets in MyApp and then relay the data.

    Edit: To communicate with VNCServer, MyApp needs to know the IP of the VNCServer. User will only be communicating with MyApp and only needs to know MyApp's IP Address. User doesn't need VNCServer's ip address.

提交回复
热议问题