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 socket prog not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "socket prog not working" Watch "socket prog not working" New topic
Author

socket prog not working

anurag jha
Greenhorn

Joined: Dec 06, 2011
Posts: 2
guys am trying to create a simple server and client program, but the program is not working.
Can you all help me out.

****ChatServer class****


****ChatClient class****


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Hello Anurag Jha, welcome to the Ranch!

I edited your post to put your code into the "Code" tags to make it readable (have a look, I'm sure you will agree that it's much better that way). Could you do that yourself in future?

As for your question... what is it? Please read our FAQ articles ItDoesntWorkIsUseless and TellTheDetails for helpful information on how to make your posts better.
anurag jha
Greenhorn

Joined: Dec 06, 2011
Posts: 2
thanks paul, your help in much appreciated and sorry for the trouble.

when i run the program, and enter String at server console ; the String is not printed in the client console.
When i tried debugging the program, i found that the control is not going beyond line 28 in ChatClient class.

but if i comment out :
lines 44 - 47 and line 50 in ChatServer class
lines 31 - 36 and line 39 in ChatClient class , then i can successfully transmit Strings from server to client.

Why is one-way communication working but two-way communication not working ?



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: socket prog not working