我想知道如何在两个客户端之间共享套接字单连接。我已按以下方式编程,并需要为开发的其余部分提供建议。
Socket (Java desktop program)
|
|
|<---------------------->|
| |
iOS Mobile client Java Applet (Runs on desktop where same Socket is there)
步骤是,
1. Java Applet connect with this socket and gets a random number from this socket, in the very first call. It is developed.
[Socket program accepts client and creates a Thread and runs ]
2. I have a text field in iOS Mobile client where user will type that random number (shared the rand number via phone or chat) which it got from that Applet. It is developed.
3. iOS Mobile client sends this random number and also get it connected with socket. It is developed.
4. I need to share images from iOS client to Applet now via this socket established.
我想知道,如何使'套接字的Applet连接'和'带有套接字的iOS客户端'处于同一个连接中,这样我就可以通过这个套接字连接将图像从iOS应用程序共享到Applet了?可以像这样在两个客户端(iOS和Applet)之间共享单个套接字连接吗?
请告诉我,如何通过两个客户之间建立的相同连接实现上述第四点。
谢谢!
答案 0 :(得分:1)
iOS客户端和applet之间没有任何关联。
虽然您可以尝试在两者之间建立连接,但您的服务器(Java桌面程序)最好充当代理,将从一个套接字上的iOS客户端接收的图像发送到另一个套接字上的applet。