File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sockets in applet

 
RAGUNATH RAVICHANDRAN
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wrote a program for socket communication in applet
but the connection cannot be established .
there is no response from the applet.
found no problem in application programming.

anyone can tell me why this happens.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the applet initialized properly? Are there any messages in the Java Console?

Also be aware that applets can normally only connect to the host where they are served from, not any other host. There are workarounds, though.
 
RAGUNATH RAVICHANDRAN
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
Is the applet initialized properly? Are there any messages in the Java Console?

Also be aware that applets can normally only connect to the host where they are served from, not any other host. There are workarounds, though.


yaeh i established socket connection inside applet.
but when i used any text boxes in side the applet its not working.
i have attached two programs just rectify it.
.........................
client program
..............

in the above program i send an declared message from client to server.
i have to send it from client text box to server's text box.
can u please help me
[ April 06, 2006: Message edited by: Ulf Dittmer ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its not working

What does this mean? What does and does not happen according to your expectations? Tell The Details.


catch (Exception E)
{
}

This is a bad idea. How are you going to know if there are any errrors that prevent the applet from working?
[ April 06, 2006: Message edited by: Ulf Dittmer ]
 
Yuan Ye
Ranch Hand
Posts: 172
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should add in your paint method. That way your contentPane will be painted and your textBoxes can be painted.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, in Swing, you should generally override paintComponent, and not paint, like you would do in AWT.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic