Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

still cant connect two applets

807597Mar 30 2005 — edited Apr 20 2005
Hello,
FIRST OF ALL, I M NEW TO JAVA
A week or two ago I posted my problem in this form regarding connectivity of my applets under sub : connect two applet on the link below(plz refer to it for better understanding of my problem):-
http://forum.java.sun.com/thread.jspa?threadID=607639
I was advised here to use a java applecation which will run on the web-server(not servlet) to act as middleware. Basically i want to pass messages between the two applets running on different machines (for a chat application).
I made the the webserver java program but i dont know how to test it, it compiled fine(without any error). I have TOMCAT3.2.4 , Windows2000prof.,j2sdk1.4.0_03.
Please tell me how to put it into work? where to put files of webserver programs?

I have some other questions too:
1. How can I change the client side applet into a popup window, bcoz applet takes the whole page and frame or popup window can display seprately. Also tell me how to embed it into the webpage?

2. When I open a connection in a client/server program by:
InetAddress add=InetAddress.getByName("iw5");//iw5 is my pc name
Sockets = new Socket(add,2000);	//establish the connection
InputStream in = s.getInputStream();
OutputStream out=s.getOutputStream();
int c; String msgReceive;
while( (c=in.read()) != '~' (c=in.read()) != -1)
{
msgReceive += (char)c;
}
Plz note that I am terminating the while loop by checking (int)c with a special char, i.e. '~'. I had to do like this bcoz -1 is not working , althought i am flushing the output stream from the other end after sending the data.

Plz help me.
Thanx in advance.
Regards
Manu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 18 2005
Added on Mar 30 2005
19 comments
131 views