如何通过套接字发送套接字详细信息 [英] How to send Socket details through a Socket

查看:94
本文介绍了如何通过套接字发送套接字详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Java应用程序,我需要通过Socket将Socket对象的详细信息传递给远程连接的计算机......我通过在对象输出流中传递套接字对象来尝试它。但由于Socket不是可序列化它不起作用...我的主要想法是获取该Socket的输入和输出流......实际上我试图通过此服务器的套接字链接两个不同的远程连接的Socket。 ..请让我知道这是个好主意吗?或者我应该想别的......或者还有其他办法吗?



谢谢......

I am developing a Java application in which I need to pass details of a Socket object to remotely connected computer through a Socket... I tried it by passing the socket object in object output stream. But as "Socket" is not "serializable" it didn't work... My main idea is to get the input and Output Stream of that Socket... Actually am trying to link two different remote connection's Socket via this server's socket... Please let me know is this a good idea? Or I should think something else... Or is there any another way to do it?

Thank you...

推荐答案

传递用于打开套接字而不是套接字本身的信息:例如IP地址和端口。
Pass the information you use to open the socket rather than the socket itself: the IP address and port for example.


这篇关于如何通过套接字发送套接字详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆