I encounter such a strange problem:
We have a VC++ Application, which needs to communicate with another Java
application using socket (in VC++ we use Windows socket indeed). The Java App
acts as the server and VC++ App as the client. The two works well when
implement them in the same computer. However, if they are implemented in
different computers, whether in a LAN or in a WAN (acrossing routers),
problem encounters: the Java App often reported it detects socket error and
close the socket (and the connection) which the VC++ client makes, then the
VC++ client will try to reconnect the Java App again, thus result in such a
situation, the connection is made, then about 20-30 seconds later, the
connection is closed, then reconnect,...
We found that often the Java App detected socket error when it tried to
write data to the client. if there was no data to write to client, Java won't
detect the socket error. Of course, the link between the two app is OK.
We don't know why, the Java App is developed by another company, and we
don't have much experience in Java so we couldn't give much advice to them.
However, in our point, we think socket programming model is universal
acrossing different platforms and different programming languages. Maybe we
are wrong? If we want to communicate Java App using Windows socket, we need
to do something special ?