由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 如何让两个socket并行执行thread
相关主题
Re: Client-Server and actionPerformed怎么练习java multithread
multi-threading guru们 (转载)怎么学multithreading/concurrency?
question on single thread & multithreadRe: How to lock a file and detect a thread is over?
socket programing server-server怎么通讯?Apply lock on a class.
[合集] 有点糊涂了,一个程序能不能开多个server socket服务?问一个基础问题
弱问socket请教:performance issue
新手问题请教:怎么把synchronize的method改成用thread 但thread safe呢?
新手问个multi-threading关于synchronized和volatile的问题Socket Connection refused in high-loaded servers
相关话题的讨论汇总
话题: socket话题: server话题: 两个话题: client话题: thread
进入Java版参与讨论
1 (共1页)
g****n
发帖数: 18
1
我有一个client和server编程上的问题,在程序中有两个client
socket,比如说socket_1和socket_2在client中,同样在server一边有两个对应的socket
,server_socket_1和server_socket_2,
现在要求socket_1和server_socket_1通信,用single
thread,socket_2和server_socket_2通信,用multithread,做不同的事情,问题是怎么
样让这两个通信并行工作(这两个通信不是synchronized) ?
非常感谢!
m**i
发帖数: 89
2
Well, you need to understand what server socket is first.

【在 g****n 的大作中提到】
: 我有一个client和server编程上的问题,在程序中有两个client
: socket,比如说socket_1和socket_2在client中,同样在server一边有两个对应的socket
: ,server_socket_1和server_socket_2,
: 现在要求socket_1和server_socket_1通信,用single
: thread,socket_2和server_socket_2通信,用multithread,做不同的事情,问题是怎么
: 样让这两个通信并行工作(这两个通信不是synchronized) ?
: 非常感谢!

c****r
发帖数: 185
3
Well, in server side, there should be a daemon thread listening to a
pre-defined port
with a server socket. When the server socket accepts, it will return a normal
socket.
Then the daemon uses another thread to handle the socket.

two
socket,比如说socket_1和socket_2在client中,同样在server一边有两个对应的socket


【在 g****n 的大作中提到】
: 我有一个client和server编程上的问题,在程序中有两个client
: socket,比如说socket_1和socket_2在client中,同样在server一边有两个对应的socket
: ,server_socket_1和server_socket_2,
: 现在要求socket_1和server_socket_1通信,用single
: thread,socket_2和server_socket_2通信,用multithread,做不同的事情,问题是怎么
: 样让这两个通信并行工作(这两个通信不是synchronized) ?
: 非常感谢!

g****n
发帖数: 18
4
Thanks, do you have a simple example that I can take a look of and get the
idea more clearly?
Thanks again!

normal
socket,比如说socket_1和socket_2在client中,同样在server一边有两个对应的socket


【在 c****r 的大作中提到】
: Well, in server side, there should be a daemon thread listening to a
: pre-defined port
: with a server socket. When the server socket accepts, it will return a normal
: socket.
: Then the daemon uses another thread to handle the socket.
:
: two
: socket,比如说socket_1和socket_2在client中,同样在server一边有两个对应的socket
: 是

1 (共1页)
进入Java版参与讨论
相关主题
Socket Connection refused in high-loaded servers[合集] 有点糊涂了,一个程序能不能开多个server socket服务?
怎么synchronize时间捏弱问socket
socket and simple web browser新手问题
问一个lock的puzzle新手问个multi-threading关于synchronized和volatile的问题
Re: Client-Server and actionPerformed怎么练习java multithread
multi-threading guru们 (转载)怎么学multithreading/concurrency?
question on single thread & multithreadRe: How to lock a file and detect a thread is over?
socket programing server-server怎么通讯?Apply lock on a class.
相关话题的讨论汇总
话题: socket话题: server话题: 两个话题: client话题: thread