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

Listening to Socket Streams  RSS feed

 
Vim Win
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having the following probem with Socket Programming :
I am writing a application (resembles to a chat application). In this I have a Server and a client. The Server has to talk to the client and the client has to talk to the server. I have one Serversocket (with one socket on its end) and another socket at the client end. I have to write messages from the client to the server. Simulataneously I have to listen to what server sends. I have only one socket and dont want to create another. Can I do this by anymeans ?
JVRN
 
Sandeep Jain
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You dont need to have two ports on the clinet or on the server .
All u need is one Port on server and the other on the client . The client should contact the server port which u will be assigning .At the same time when the server recieves a request from the client it will store its port and store in in some hashtable .so that next time it has to send the data back it should know to which port it has to send the data back .

If u have any further queries you can mail me .

------------------
Sandeep Jain
 
satishind Reddy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sandeep,
I am very new in Socket and ServerSocket coding. Can you send a sample code regarding Chat. It will be more helpfull to me.
And also let me know which books or Internet site gives very good idea and Command on above topics.
My Mail id is : satishind@123india.com
Thanks
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Ranch has a naming policy, described here and "jvijay" is not a valid name. Please choose one which meets the requirements.
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!