Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sockets, streams, and confusion

 
Adam Confino
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Java Gurus,

I wrote a simple chat program. Now I am trying to modify the server so that will chat on one port and transfer a file on another. When I run this class, the writeFile() method does not diplay any of its System.out.println() messages which makes me believe it is not being called. Thanks for any help you can give. I really do appreciate it.

Adam

 
David Kilcy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the constructor you call both listen() and writeFile(). First listen() is invoked from the constructor, but it never leaves because you have a while(true) loop in there.
So it never breaks out of the constructor.
Hope that helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic