Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

multi sockets opening in one client  RSS feed

 
Roy Huang
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shubhrajit Chatterjee
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Roy Huang
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!