wood burning stoves 2.0*
The moose likes Applets and the fly likes sockets in applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "sockets in applet" Watch "sockets in applet" New topic
Author

sockets in applet

RAGUNATH RAVICHANDRAN
Greenhorn

Joined: Mar 29, 2006
Posts: 3
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
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
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.


Ping & DNS - my free Android networking tools app
RAGUNATH RAVICHANDRAN
Greenhorn

Joined: Mar 29, 2006
Posts: 3
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
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
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

Joined: Mar 05, 2003
Posts: 172
I think you should add in your paint method. That way your contentPane will be painted and your textBoxes can be painted.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
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.
 
subject: sockets in applet
 
Similar Threads
Java program protection.
Applet with a ServerSocket
WA #1.....word association
Clock
Clock