File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes how to work with socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply locked New topic

how to work with socket

loveAnil Nayak

Joined: Dec 29, 2009
Posts: 3
actually i have two GUI programs


Client1 will send data Client2 will receive and vice versa.

i have used socket but when the socket object is created by
Socket client = new Socket(InetAddress.getLocalHost(),1581);

Socket server = new Socket(InetAddress.getLocalHost(),1581);

what happened that on program is running and other get closed automatically because one socket is not shared by two program simultaniously

how to use the socket or any other class so that both side communication will be possible

and another problem is

if client1 program is sending data to client2 program with out interfering to that program client1 how to display data in GUI of client1(textarea)

so how to do both side communication both will send both will receive
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Please do not post the same question multiple times: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
I agree. Here's the link:
subject: how to work with socket
It's not a secret anymore!