This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 41598
    
  55
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: 41598
    
  55
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: 41598
    
  55
Also, in Swing, you should generally override paintComponent, and not paint, like you would do in AWT.
 
 
subject: sockets in applet