简体   繁体   中英

Socket Programming

In my java application i have two textfields which contain listening and sending port number. This application runs well on 1 client and server machine. How can i make it work on multiple clients to 1 server. eg on Client Side : listening port = 2345 sending port = 2346

on Server Side : listening port = 2346 sending port = 2345

this works for 1 client and server. How can i make it work for multiple clients with the server.

http://www.ase.md/~aursu/ClientServerThreads.html这是您对问题的解释(多线程服务器)

Basically you would like to accept an incoming request, and handle that request in a separate thread, so that your main thread can continue to listen for new requests. An excellent example (including code) can be found at http://download.oracle.com/javase/tutorial/networking/sockets/clientServer.html#later .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM