connecting client

I want the connection between two client such that messages between two client are pass directly,without passing through serverWill it possible if yes then please tell me the procedure for doing that thank you for replies
[242 byte] By [alok_agrawala] at [2007-11-26 19:23:46]
# 1

One of the clients creates a ServerSocket and calls accept(), the other client connects to it.

You could also use UDP instead of TCP. But that's usually more advanced, as you have to deal with limited message size, duplicated messages, lost messages, out-of-order messages, firewall issues, and whatnot.

sjasjaa at 2007-7-9 21:45:43 > top of Java-index,Archived Forums,Socket Programming...
# 2
thanks for reply. bt as client is running on that port ( port ,ip etc) , so u cant create server socket on same port to listen for connection frm other clients coz on one port only one process can run !! if its possible , then plz tell me how can i procced ?thnk u !!
alok_agrawala at 2007-7-9 21:45:44 > top of Java-index,Archived Forums,Socket Programming...
# 3

> but as client is running on that port ( port ,ip etc)

What do you mean by 'running'?

> so u cant create server socket on same

> port to listen for connection frm other clients

That's what I would normally mean by 'running on that port'.

Do you have some other meaning in mind?

ejpa at 2007-7-9 21:45:44 > top of Java-index,Archived Forums,Socket Programming...
# 4

sir,i want to tell that is it possible tthat one program act both as a client and server,I think it is not possible.

What my basic need is to connect to client to whom i want to send message, without passing that message through server ie i want ppp connection between two clients.

please tell me is it possible, if yes then guide me how to do it.

As i am begginer of java i don't know much about advance java or rmi.

I will be very thankfull to you for your valuable time and Replies

alok_agrawala at 2007-7-9 21:45:44 > top of Java-index,Archived Forums,Socket Programming...
# 5
The first paragraph of the reply #1 is THE answer you want.Period.
hiwaa at 2007-7-9 21:45:44 > top of Java-index,Archived Forums,Socket Programming...