> Hi,
>
[quoted text clipped - 5 lines]
> of net package, can i connect the server with TCP via any programming
> languages' TCP libraries?
It's all TCP/IP on the wire. It doesn't matter how each end is written.
> And which method do you advice? (nio or net)
Go for java.net. There are ways java.nio can be more efficient (in terms
of CPU cycles), but it is unnecessarily complicated for most problems.
> To send the message through server, there must be 2 established
> connection between users and server. Server is going to keep the
[quoted text clipped - 4 lines]
> user name. And sends the message to usr2. Is this a correct way of
> messaging?
Sounds reasonable. However, if you have the same thread that reads the
message from the sender also write to the recipient, any delays relaying
the message will prevent the next message being read. So it's normal to
have two threads for each connection.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/