开发者

(How) can I use ServerSocket to listen for UDP instead of TCP traffic?

开发者 https://www.devze.com 2023-01-22 07:52 出处:网络
In my application, there\'s a module that uses ServerSocket to li开发者_运维知识库sten for incoming TCP connections. When I switched a client to use UDP, I expected to receive data anyway, but I was w

In my application, there's a module that uses ServerSocket to li开发者_运维知识库sten for incoming TCP connections. When I switched a client to use UDP, I expected to receive data anyway, but I was wrong. When I looked at the documentation, however, I couldn't find any config option to set up the socket for UDP. Do I have to use a different class?


Use DatagramSocket. For a tutorial, look here http://download.oracle.com/javase/tutorial/networking/datagrams/index.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号