hanks, Remy ! Your comment is much helpful to us, so that we can put
attention to the Java App, not waste time on suspecting the synchronous mode
of socket and etc.
However, i think the best way to test is to make a simple Java App which
provide similar server functionality: listen for new connection, and write
some data to client. However, I have little experience in java programming,
could it possible for you to give me some advice or simple java code segment
to do so (listen and write data)?
For other issue, see my comment below please.
"Remy Lebeau" wrote:
*** I am not much clear, according to the running log, the Java App just
report Socket (connected with ###IP) error. I used to take a short look at
their code segment, seemed the Java App catch the IOException.
*** the reason we use asynchronous mode socket is that we just have a class
dedicated to connet a lot of different socket servers using asynchronous mode
connect() method. This class has 2 threads in it, one for connecting, and the
other for checking connecting result. In our experience, if one server is not
reachable, the synchronous mode connect() method may wait for a long time (10
seconds or even more), so in order to avoid affecting connecting operations
to other servers in case of some servers not reachable, we choose
*** And, we do have a general class for communicating with servers using
socket. This class has 2 threads in it, one for read using blocking recv()
method, the other will check a data queue to see whether there is data to
send, if no, the thread is blocked, thus the read and write operation on the
socket are totally seperate, and the performance may be better. we do know
this may result in comsuming much more threads, but in our case, we generally
have 20-30 servers to communicate at most, so the thread comsumption is not a
big issue. In case of large amount of servers (indeed, we do have such an App
with 300 servers to connect), we choose IOCP method so that we can use
limited threads to serve the communication, but IOCP is much more complicated
and asynchronous mode nust be employed. This new method is under testing.