File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes multi sockets opening in one client Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "multi sockets opening in one client" Watch "multi sockets opening in one client" New topic
Author

multi sockets opening in one client

Roy Huang
Ranch Hand

Joined: Nov 21, 2001
Posts: 104
Is it possible to open mutiple sockets from a client(ex. applet)
to communicate with sevral servers?
If I want to keep 2 sockets with separate ports working simutaneously, one for sending out stream, another for receiving stream. -- But not interfere with each other, what should I take care?
(ex. threads..)
Thanks.


SCJP 1.4/SCBCD/SCWCD<br />MCSE<br />IBM professional XML Developer<br />SAP certified Development Consultant (NetWeaver portal and Web JavaApplication)
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
It is possible to open multiple socket connections from a client. If you want simultaneous connections then each should ideally be running on a different thread
[This message has been edited by Shubhrajit Chatterjee (edited December 12, 2001).]


Shubhrajit
Roy Huang
Ranch Hand

Joined: Nov 21, 2001
Posts: 104
Shubhrajit, thanks,
I want to implement two audio stream transferring through sockets -- which are already in the ByteArrayInputStream.
but the usuall example for the socket is to use a Bufferedreader and Printerwriter to wrap your character stream, not byte stream.
In my case, should I also use the wrapper(ex. bufferedInputstream)
or directly send it as a ByteArrayInputstream?
thanks.
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
Originally posted by Roy Huang:
I want to implement two audio stream transferring through sockets -- which are already in the ByteArrayInputStream.
but the usuall example for the socket is to use a Bufferedreader and Printerwriter to wrap your character stream, not byte stream.
In my case, should I also use the wrapper(ex. bufferedInputstream)
or directly send it as a ByteArrayInputstream?


You can use ByteArrayInputStream , no problem with that. One thing I forgor to mention... if u use an applet then you can only open a socket connnection to the host from which the applet was downloaded(for security reasons)
------------------
Shubhrajit
 
 
subject: multi sockets opening in one client
 
Threads others viewed
example socket
Can Someone tell me what I am doing wrong??
Applets with HTTP Tunneling
sending chatuserlist to all clients
two sockets communication in multi-thread
MyEclipse, The Clear Choice