aspose file tools*
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 Java 8 in Action this week in the Java 8 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: 39575
    
  27
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 - updated with new look and Ping home screen widget
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: 39575
    
  27
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: 39575
    
  27
Also, in Swing, you should generally override paintComponent, and not paint, like you would do in AWT.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sockets in applet
 
Similar Threads
Clock
WA #1.....word association
Applet with a ServerSocket
Java program protection.
Clock